php.netfacebook-like

Find photo or comment based on number of likes Facebook


I need to find any comments, photo or pages with certain number of likes using the Facebook API.

I am programming in PHP and .net, is there anyone who knows how or have done something similar?

Edit

I was thinking about using the FQL, something like:

SELECT photos,comments,pages From photos where likes >=10

Solution

  • It is possible, but you're going to have to limit the photos you get to people you know.

    Pages are the easiest. This will get you all the pages that you and your friends like with at least 100 fans:

      SELECT name, username, page_id, fan_count FROM page WHERE page_id IN 
       (SELECT page_id FROM page_fan WHERE uid IN
          (SELECT uid1 FROM friend WHERE uid2 = me()) 
          OR uid = me()
        )
      AND fan_count>100 ORDER BY fan_count DESC
    

    Photos are more of a challenge, since photos are not directly indexable by user. This will get you all the photos of a user and ones the user has been tagged in:

    SELECT src, caption, like_info FROM photo WHERE (
      object_id IN (SELECT object_id FROM photo_tag WHERE subject = me()) 
      OR 
      album_object_id IN (SELECT object_id FROM album WHERE owner = me())
    )
    

    The number of likes is a member of like_info called like_count. I can't figure out how to sort or filter on this right now.