• 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

    • It makes no sense to name it iOS 26 after iOS 18 but logic has left the building a long time ago (remember Microsoft and their Windows 8, 8.1 and 10 or Windows 7 that was actually 6.2)? Not to mention the stupid trend of "rapid releases" where minor releases with some bug fixes and UI changes (basically unnoticeable) masquerade as major releases...
    • Have you tried setting your font to Aptos? Its specifically designed to display better.
    • WebChangeMonitor 25.06 by Razvan Serea Monitors allows you to quickly check a number of web pages and tracks changes based on the content of the web pages. Allows to monitor several protocols, including HTTP and HTTPS. Allows to view and record differences. Available for Win7/10, Linux and others. WebChangeMonitor features: Allows monitoring of web pages and informs about content changes Indication of states of currently monitored items in the tool and taskbar Reporting as sound and/or email as well as log file or HTML log Several configuration / filter options Support all protocols, e.g. http, https Multi-threaded, running in the background Bulk-import and bulk-export of items (from/to CSV) to monitor Export of results to CSV file for further processing Allows running command on items states and/or showing diff (changes) of content with preferred diff-tool ...and many more! Open Source (C++, wxWidgets) Cross platform for Windows (7/10), Linux, RPi and Mac (if self-compiled) WebChangeMonitor 25.06 release notes: Updates several libraries to stay up-to-date with latest security fixes. Few bug-fixes took place related to ignore items being no displayed correctly sometimes in the UI. especially, the sqlite library was updated to hopefully also fix a recent (but very rare and random) crash bug. Download: WebChangeMonitor 64-bit | 8.9 MB (Open Source) Download: WebChangeMonitor 32-bit | 8.2 MB View: WebChangeMonitor Website | Other Operating Systems | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • KEF Q Concerto Meta, Polk Reserve R200 Limited Edition speakers are lowest priced by Sayan Sen Nowadays, soundbars with wireless subwoofer systems offer people a convenient way to experience decent-quality audio; systems such as the Samsung Q900F, Q800F, and Q800F, which are available at their lowest price levels. However, if you are someone who is looking for a smaller bookshelf speaker for more sound accuracy and can live without louder or deeper bass notes, then take a look at KEF and Polk Audio's Q Concerto Meta and Reserve R200 speakers, respectively, as both of them are up for sale at their lowest ever prices (purchase links under the specs lists below). First up, we have the KEF Q Concerto Meta, which is a three-way stereo system despite being designed within a small bookshelf footprint. That is because the KEF has a coaxial Uni-Q driver array that packs both the mid-range and tweeter. The woofer is a 6.5-inch driver, and thus it does not go below 48 Hz, so you will need a separate subwoofer if you want bass frequencies below that. This is a passive speaker with two terminals and no other fancy connectivity features. The technical specs of the KEF Q Concerto Meta are given below: Drive Units: Uni‑Q Driver Array: HF: 19 mm (0.75 in.) vented aluminium dome with MAT™ MF: 100 mm (4 in.) aluminium cone Bass Unit (LF): 165 mm (6.5 in.) hybrid aluminium cone Frequency Response: (-6 dB): 40 Hz – 20 kHz (±3 dB): 48 Hz – 20 kHz Typical In-Room Bass Response (at -6 dB): 36 Hz Crossover Frequencies: 430 Hz and 2.9 kHz Amplifier Requirements: 15 – 180 W Sensitivity (2.83V/1m): 85 dB Harmonic Distortion (at 90 dB, 1m): Less than 2% above 37 Hz Less than 1% between 91 Hz – 20 kHz Maximum Output: 108 dB Impedance: 4 Ω (minimum 3.2 Ω) Connectivity: Wired connection only (no wireless options) Get the KEF Q Concerto Meta at the link below: KEF Q Concerto Meta Three-Way Bookshelf Speaker (White, Pair): $1199 (Amazon US) Up next, we have the Polk Audio Reserve R200 50th Anniversary model. This is a special edition speaker and the company says that only 1000 pairs were produced. Unlike the KEF, this is a two-way design and so does not have a mid-range driver. So you do sacrifice some of the mids. However, it should still be great for listening to music as vocals are mainly necessary for movie-watching. The technical specs of the Polk Reserve R200 are given below: 1" Ring Radiator Tweeter 6½" Turbine Cone Woofer Minimum Impedance 3.8Ω Sensitivity 86dB Recommended Amplifier Power 30–200W Frequency Response (-3dB) 51Hz–38kHz Get the Polk Reserve R200 limited edition at the link below: Polk Reserve R200 50th Anniversary Limited Edition Bookshelf Speaker - Dolby Atmos & IMAX Enhanced, Cherry: $797.97 (Amazon US) This Amazon deal is US-specific and not available in other regions unless specified. If you don't like it or want to look at more options, check out the Amazon US deals page here. Get Prime (SNAP), Prime Video, Audible Plus or Kindle / Music Unlimited. Free for 30 days. As an Amazon Associate, we earn from qualifying purchases.
  • Recent Achievements

    • Week One Done
      abortretryfail earned a badge
      Week One Done
    • First Post
      Mr bot earned a badge
      First Post
    • First Post
      Bkl211 earned a badge
      First Post
    • One Year In
      Mido gaber earned a badge
      One Year In
    • One Year In
      Vladimir Migunov earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      488
    2. 2
      +FloatingFatMan
      257
    3. 3
      snowy owl
      247
    4. 4
      ATLien_0
      222
    5. 5
      +Edouard
      191
  • Tell a friend

    Love Neowin? Tell a friend!