blah blah blah is here! blah blah » Close

up0down
link

I wanna how to extract images from a given URL.For Ex I want to download all flags in the link http://www.fotw.net/flags/iso3166.html so for this can anyone help. i want only 2nd image from each and every country page.

last answered 2 years ago

1 answers

up0down
link

You can download the source of a webpage using new WebClient().DownloadString(websiteUrl)
You can then extract the links using a regex like "<a target="_new" href=""(?<link>[a-z]{2}.html)"">(?:[^<]*)</a>"
You can then use the WebClient.DownloadString to download the source of that website, and then use another regex like "../images/[a-z]/[a-z]{2}.gif" to extract the images.
Finally you would use Image.FromStream to download the image and then Image.Save to save it.
Just post back if you need any help on the details.

This post was imported from csharpfriends, if you have a similiar question please ask it again.

All previous members have been migrated, hope you enjoy the new platform!

Feedback