• 0

Need with with Imgur program


Question

Hey guys,

I wanted to work on a new project just for fun, so I thought a program that downloaded imgur galleries would be cool. I am working on it, but the program will run through duplicates after 51 images usually.

I've looked at all i can and can't find the problem. My guess is that it's the server resetting me. I wanted a challenge so i tried to get past it. I tried creating a new url connection each time, I also created a seperate class that did the downloading and creating a new object of that class everytime but it didn't work.

Thoughts?

Source

http://shayconcepts.com/programming/ImgurGalleryDownloader/imgurDL.zip

Link to comment
https://www.neowin.net/forum/topic/1110175-need-with-with-imgur-program/
Share on other sites

19 answers to this question

Recommended Posts

  • 0

You are parsing the HTML page. Don't do that. Use imgur's API instead - from the documentation, you can just append ".xml" to any gallery page and it returns the gallery as an XML file.

In general, don't parse HTML pages unless there is no other way. It's not easy and it can change any day, making your program useless.

  • 0
  On 04/10/2012 at 20:30, Aethec said:

You are parsing the HTML page. Don't do that. Use imgur's API instead - from the documentation, you can just append ".xml" to any gallery page and it returns the gallery as an XML file.

In general, don't parse HTML pages unless there is no other way. It's not easy and it can change any day, making your program useless.

Thanks! I'll take a look.

EDIT: it seems it only returns 56 images though :/

  On 05/10/2012 at 01:51, Dr_Asik said:

I learned about regex and it has worked really well for me! I'll take a look at your link and find a better way to parse HTML. Thanks!

  • 0
  On 05/10/2012 at 04:14, thatguyandrew1992 said:
I learned about regex and it has worked really well for me! I'll take a look at your link and find a better way to parse HTML. Thanks!
If you really need to parse HTML, you should use a proper HTML library; for Java there is HtmlUnit and Jsoup at least. Better would be to not parse any HTML and use imgur's API as Aethec suggested.
  • 0
  On 05/10/2012 at 06:05, Dr_Asik said:

If you really need to parse HTML, you should use a proper HTML library; for Java there is HtmlUnit and Jsoup at least. Better would be to not parse any HTML and use imgur's API as Aethec suggested.

But when using the API, I append the .xml but it doesn't show ALL the images in the gallery

  • 0
  On 12/10/2012 at 04:27, thatguyandrew1992 said:

Ok guys, I need some more help. How do I get the xml of an album? They are apparently different than galleries! The xml page isn't coming up. Or if there isn't an xml, what is recommended to get the images?

Ex

http://imgur.com/a/HKtAR/

It's all there in the API documentation: http://api.imgur.com/resources_anon#album

Example: http://api.imgur.com/2/album/HKtAR

  • 0
  On 12/10/2012 at 14:05, ZakO said:

It's all there in the API documentation: http://api.imgur.com...rces_anon#album

Example: http://api.imgur.com/2/album/HKtAR

Thanks! I'm learning how to use APIs, I know this is all obvious. I thought I had looked through this. ill be sure to look extra hard!, >.<

This topic is now closed to further replies.
  • Posts

    • iPadOS 26 is now official with improved windowing, menu bar, 'Liquid Glass' redesign, more by Taras Buria As expected, today, at WWDC 2025, Apple announced iOS 26 and other operating systems that now carry the 26 version number (for simplicity). iPadOS is also part of the big redesign, and it is now official with the new Liquid Glass design, improved window controls, a Mac-like menu bar, file management enhancements, and more. In addition to the general Liquid Glass redesign, which is now present across all of Apple's operating systems, iPadOS 26 received several iPad-exclusive upgrades. It now has a reworked windowing system that helps you organize and switch between apps. You can finally place and resize apps exactly how you want. Plus, iPadOS now has familiar window controls: three buttons for closing, minimizing, and resizing your app. Straight from macOS. Apps can now remember their previous size and position, and Expose can show you all open windows. Finally, iPadOS now has a menu bar, which is another thing that comes from macOS. It gives access to common actions, commands, and features. Developers can customize the menu bar in their apps and specify what features are available there. Apple is also upgrading the Files app with a reworked List view, which now shows more details about your files and the ability to expand or collapse folders. Plus, you can customize folders with colors and emojis, pin folders to the dock, and set default apps for file types. When working with long-running processes, background tasks show up as live activities, so that you can track Final Cut exports or the Files app moving stuff around. Other changes in iPadOS 26 include improved audio controls and the ability to select audio input source and record audio with voice isolation. The Journal app is now available on the iPad, Notes received markdown support, and Calculator now supports 3D graphing capabilities. You can learn more about iPadOS 26 in the official announcement post here.
    • That same Brave that tried to insert their own ads instead of blocked ones?
    • lol more spy centers - great work tiny hat gov. The surveillance state is licking it's chops so Palantir can know your every thought and move. 1984 is already here folks. Maybe start fighting it instead of contributing to it? Here is a good start - stop putting your entire life on a computer. Walk outside and see real life.
    • How long until Microsoft, Google, and others go (back) to this design trend?
  • Recent Achievements

    • Rookie
      CHUNWEI went up a rank
      Rookie
    • Enthusiast
      the420kid went up a rank
      Enthusiast
    • Conversation Starter
      NeoToad777 earned a badge
      Conversation Starter
    • Week One Done
      VicByrd earned a badge
      Week One Done
    • Reacting Well
      NeoToad777 earned a badge
      Reacting Well
  • Popular Contributors

    1. 1
      +primortal
      476
    2. 2
      +FloatingFatMan
      279
    3. 3
      ATLien_0
      255
    4. 4
      Edouard
      204
    5. 5
      snowy owl
      200
  • Tell a friend

    Love Neowin? Tell a friend!