简体   繁体   English

Facebook Open Graph故事中有多个对象?

[英]Multiple Objects in a Facebook Open Graph Story?

I am trying to do something like what Spotify does with posting the music that users are currently listening to to their activity log. 我正在尝试做类似Spotify的事情,将用户当前正在收听的音乐发布到他们的活动日志中。 When someone listens to a song on Spotify, it shows up as "User listened to {song name} by {artist name} on Spotify." 当某人在Spotify上收听歌曲时,它显示为“用户在Spotify上按{艺术家名称}收听了{歌曲名称}”。 All I can get is "User has listened to {song name}." 我所能获得的只是“用户已听过{歌曲名称}”。 How do I pass the artist name and where they listened to the song? 如何传递歌手姓名以及他们在哪里听歌? Here is my code so far: 到目前为止,这是我的代码:

FB.api(
    'me/musicalfamilytree:is_listening_to','post', {
        song: "link to song",
        album: "link to album",
        musician: "link to musician",
        expires_in: "duration in seconds"
    }
);

In all of the pages I have the following meta tags (which I have debugged with Facebook's object debugger): App_id, url, type, title, site_name, musician. 在所有页面中,我都有以下元标记(已使用Facebook的对象调试器进行了调试):App_id,URL,类型,标题,site_name,音乐人。

I've found good documentation on these sites: 我在这些站点上找到了很好的文档:

https://developers.facebook.com/docs/opengraph/music/ https://developers.facebook.com/docs/reference/opengraph/object-type/music.song/ https://developers.facebook.com/docs/opengraph/music/ https://developers.facebook.com/docs/reference/opengraph/object-type/music.song/

To get posts like Spotify you'll need to use the builtin music.listens action, as documented here: http://developers.facebook.com/docs/reference/opengraph/action-type/music.listens 要获取Spotify之类的帖子,您需要使用内置的music.listens操作,如此处所述: http : //developers.facebook.com/docs/reference/opengraph/action-type/music.listens

Your example would then look like 您的示例将如下所示

FB.api(
    'me/music.listens','post', {
        song: "link to song",
        expires_in: "duration in seconds"
    }
);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM