• 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

    • Always nice to have an updated official windows installer / ISO.
    • Google launches Doppl, an app that lets you to try on new clothes without leaving your home by Aditya Tiwari Google Labs, home to the search giant's experimental projects, has released a new app called Doppl. The app lets you try clothes virtually on an animated version of yourself and lets you visualize how an outfit might look on you. Doppl builds on the virtual try-on features announced at this year's Google I/O developer conference as a part of Google Shopping, which allowed users to virtually try billions of clothing items after uploading a photo. The experimental app brings more features such as the ability to use photos or screenshots to "try on" outfits. The app can convert static images to AI-generated videos with "dynamic visuals" to give a better idea of how an outfit might look. You can also share the AI-generated video with your friends to get a second opnion. "With Doppl, you can try out any look, so if you see an outfit you like from a friend, at a local thrift shop, or featured on social media, you can upload a photo of it into Doppl and imagine how it might look on you," Google explained in a blog post. However, the search giant cautions that it's still an experiment at the end of the day. When trying virtual outfits, things like fit, appearance, and clothing details may not be accurate all the time. Doppl is available to Android and iOS users living in the US, but there is no word on when (or if) the app will arrive in other regions. The app requires you to upload a full (non nude) body photo or use an AI model to try on different looks and styles. The app adds to the platter of shopping experiences the company has been baking into its products and services. Alongside virtual try-on, Google previously updated the AI Mode in Google Search with features to browse, consider options, and refine product searches. Google also introduced an agentic checkout experience to buy products at a price that falls under your budget. It lets you track price on any product listing, set the right size or color, and the amount you want to spend. The tool can complete the buying process on your behalf. Plus, lets be honest... if you hate dealing with people, this app might be just what you need.
    • And McAfee. The only computer that I've come across that had both an antivirus and got infected by one of those devastating encryption viruses and McAfee installed. Total piece of crap.
    • INXS - Need You Tonight @+thexfile Haven't heard that Joe Walsh album above in years. Might have to dig it out.
  • Recent Achievements

    • Conversation Starter
      Kavin25 earned a badge
      Conversation Starter
    • One Month Later
      Leonard grant earned a badge
      One Month Later
    • Week One Done
      pcdoctorsnet earned a badge
      Week One Done
    • Rising Star
      Phillip0web went up a rank
      Rising Star
    • One Month Later
      Epaminombas earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      550
    2. 2
      ATLien_0
      206
    3. 3
      +FloatingFatMan
      180
    4. 4
      Michael Scrip
      148
    5. 5
      snowy owl
      119
  • Tell a friend

    Love Neowin? Tell a friend!