0

How to retrieve all photos from a Flickr photoset?

Hi,
I'm trying to use YQL to retrieve all Flickr photos belonging to a specific set in my account. Using the Flickr API, I would use flickr.photosets.getPhotos (http://flickr.com/services/api/flickr.photosets.getPhotos.html). However, I cannot find a corresponding table in YQL.
Any idea?
Thanks,
Nicolas

by
1 Reply
  • Hi Nicolas,

    I didn't see a table for that either, but here's a really hack way of doing it:

    We can get the photo container HTML by capturing the HTML page for the set and use xpath to capture the data we want...like:
    CODE
    select * from html where url="http://www.flickr.com/photos/{USER ID}/sets/{SET ID}/" and xpath='//div[@id="setThumbs"]/div'


    Now here the issue is that there are only 60 pictures per page. What we can do is capture the # of pictures on that same page (capture the <p># of pics</p> element) like so:
    CODE
    select * from html where url="http://www.flickr.com/photos/{USER ID}/sets/{SET ID}/" and xpath='//div[@class="Results"]/p'


    From that number, we can calculate how many pages there are (i.e. 61 - 120 = page 2) and then we can run the pic capture query on the other pages like:
    CODE
    http://www.flickr.com/photos/{USER ID}/sets/{SET ID}/?page=2


    I'm sure there's a much easier way for this but that's my hacky idea ;)Nicolas
    0
  • The better way is to create your own open data table that would nicely wrap that particular API call.

    Jonathan
    0
  • Recent Posts

    in YQL