Downloading images from Flickr and Picasa
We have a list of images in the XML format, which we downloaded in the Fetching lists of photos from Flickr and Picasa recipe. Let's download the actual photos from the photo hosting.
Getting ready
Here, we need the image list from Flickr or Picasa to get started. Use the previous recipe to download that list.
How to do it…
- Once we have retrieved the list, we extract individual image IDs from it. Having these IDs allows us to form the URLs for individual images. Flickr uses a complicated image URL formation process and Picasa stores the URLs directly. Both services can generate responses in XML and JSON formats. We will show you how to parse XML responses using our tiny ad hoc parser. However, if you already use some kind of XML or JSON parsing library in your project, you are encouraged to use it for this task too.
- To parse the Flickr XML list, we use the following function:
void Flickr_ParseXMLResponse( const std::string& Response, ...