• 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

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 :/

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
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

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

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

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

    • RustDesk 1.4.8 by Razvan Serea RustDesk is a fast, secure, and open-source remote desktop software designed for self-hosting, remote access, and IT support. It provides a privacy-focused alternative to TeamViewer and AnyDesk, offering full control over your data with minimal configuration. The client is fully open source, while users have the option to choose between two server solutions: the Professional Server, a premium offering with advanced features available for purchase, and the Basic Server, a free and open-source alternative for those who prefer a self-hosted setup. RustDesk features Open-source & free remote desktop solution Cross-platform compatibility – Works on Windows, macOS, Linux, iOS, Android, and Web End-to-end encryption (E2EE) based on NaCl for secure connections Peer-to-peer (P2P) connectivity for fast and private remote access Self-hosting support – Own your data with easy deployment on your infrastructure Supports VP8, VP9, AV1 (software) and H264, H265 (hardware) codecs for efficient streaming Unattended access for remote management File transfer & clipboard sharing Multi-monitor support & remote printing Low-latency & high-performance remote access Session recording & chat functionality Professional & Basic server options for flexible deployment Lightweight & minimal resource usage No third-party server dependency for privacy No installation or admin privileges needed on Windows (elevate privileges locally or remotely on demand) Easy installation & minimal configuration required Custom branding & enterprise-level features available RustDesk 1.4.8 changelog: Added Add Windows arm64 support #15139 Feature: Add monitor-switch buttons to remote toolbars #15342 Refact/privacy mode 1 multi monitors #15321 autocomplete online #15313 feat: theme logo #15268 Changes refact: restart remote device, autoconnect #15290 refact(oidc): icon azure to microsoft #15278 Refact/printer driver default unchecked #15191 Revert "fix(iPad): keep touch gestures with external mouse" #15288 Fixes fix Wayland→Wayland clipboard paste fix(arm64-linux): fix CJK font rendering on flutter-elinux #15324 iOS: autocorrect/data detectors corrupt the server Key field (ID/Relay Server settings), making valid keys impossible (or very hard) to enter #15293 fix(ios): mouse mismatch #15339 fix(linux): reap leftover logind session procs on headless teardown #15337 Crash on startup (0xc0000409) / Fast Fail in librustdesk.dll on Windows 11 26H1 #15218 fix(clipboard): Windows DIB images, fill missing alpha #15296 Fix/generate py target injection #15248 Fix clipboard synchronization not fully disabled in View Only mode #15224 fix(keyboard): win, key, Pause #15351 Download: RustDesk 64-bit | MSI | 32-bit ~20.0 MB (Open Source) Links: RustDesk Home Page | Other platforms | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • This makes me think of Dune for some reason.
    • I'm too old to return to the "good old days" when I was installing custom ROMs and tinkering with my devices - now I just want to turn it on and use it. I've read that banking and payment apps work on Murena /e/OS (I'll have to check the ones I use) and I also really want to support Fairphone 😉
    • Time to start going to the local church and play Bingo for a while.
  • Recent Achievements

    • mike_rumble earned a badge
      First Post
    • tuben earned a badge
      Dedicated
    • mnsgroup earned a badge
      Week One Done
    • sumytbe earned a badge
      Conversation Starter
    • B4dM1k3 earned a badge
      One Year In
  • Popular Contributors

    1. 1
      +primortal
      502
    2. 2
      +Edouard
      203
    3. 3
      PsYcHoKiLLa
      98
    4. 4
      Michael Scrip
      80
    5. 5
      neufuse
      67
  • Tell a friend

    Love Neowin? Tell a friend!