Categories
Development

YQL flickr.photos.search nest query

I wanted to use YQL to build a query to grab photos on an account with certain tags that I could then render on a page. The flickr.photos.search just gets you the photo’s id and not all the other goodness that is required to make the image display.

So I built a nested query in YQL to get the job done.

select farm, id, secret, server, title
from flickr.photos.info
where photo_id in (select id from flickr.photos.search where user_id='<your_user_id>' and tags='soccer,men')

So in one call it’s gets the id of the photos that meet your initial query:

select id from flickr.photos.search where user_id='<your_user_id>' and tags='soccer,men'

It then takes the id’s from that query and grabs the photo.info that you need, all in one call! Very cool stuff.

Go to the YQL Console and play around.

Leave a Reply

Your email address will not be published. Required fields are marked *