Thursday, April 28, 2011

Downloading images

I have a requirement where a user can specify a url

http://www.mysite.com/displaythread.php?t=863

He then specifies total no of pages in that thread and the software automatically loops through all pages and downloads images

For eg: If no of pages is 20, then the pages looped will be in following manner

http://www.mysite.com/displaythread.php?t=863 to http://www.mysite.com/displaythread.php?t=863&page=20

How can I write code for it?

From stackoverflow
  • Sounds fairly simple, using WebRequest, optionally HTML Agility Pack, and a for loop.

    KJai : Thanks. Inside this url eg: http://www.mysite.com/displaythread.php?t=863&page=8, I have images hosted on different sites..how can I access these images and download them
    Matthew Flaschen : You need to be more specific about what you're having trouble with, KJai.
    KJai : The Agility pack is good but is huge..I just need the lines of code that help me extract images or even give me links by looping through a page range in a thread..Thread in the above case is 863 and that thread has 20 pages..
    KJai : Ok I got the GetDocLicks.cs..And it's giving me a lot of url's//How can I filter the url's that have .jpg at the end of them?
    KJai : Figured it out..thanks

0 comments:

Post a Comment