FQL get liked artists

2019-07-26 09:52发布

Is it possible, using FQL, to get the liked artists(music) of a user? I check the permissions and I couldn't find anything related to it and I am not a facebook user so I am not sure if it's even possible.

1条回答
Evening l夕情丶
2楼-- · 2019-07-26 10:19

The Like table doesn't give back the interests, but:

An FQL table that returns the IDs of users who like a given object (video, note, link, photo, or album).

That's not what we need.

First way - Rapid description

In the User table, you'll find a music field which sends back one line containing all the liked artists. The query would be as easy as:

SELECT music FROM user WHERE uid = me()

{
  "data": [
    {
      "music": "Macarize, MARCEL DETTMANN, Alan Fitzpatrick"
    }
  ]
}

Second way - Detailed results

By the Page_fan table we get the user's music interests one by one.

SELECT name, type FROM page WHERE page_id IN (
    SELECT page_id FROM page_fan WHERE uid=me() AND profile_section="music")

{
  "data": [
    {
      "name": "Macarize", 
      "type": "RECORD LABEL"
    }, 
    {
      "name": "MARCEL DETTMANN", 
      "type": "PRODUCER"
    }, 
    {
      "name": "Alan Fitzpatrick", 
      "type": "MUSICIAN/BAND"
    }
  ]
}
查看更多
登录 后发表回答