7

Open Graph API を介してウォール ポストが作成された場合、Facebook がウォール ポストに画像をレンダリングする方法が必要です。

このリンクを facebook.com の Facebook UI にコピー アンド ペーストして投稿すると、ウォール ポストは次のようになります。

FB ウォール ポストのレンダリング イメージの成功

しかし、以下のコードを使用して、Facebook Python ライブラリを使用してプログラムでウォールにアクセスしようとすると、画像がレンダリングされません。

graph = GraphAPI(valid_access_token)
graph.put_wall_post(message='https://s3.amazonaws.com/dotellapptest/review_photos/enlarged/811..OJUzXI76Rw6J2Zj_vZyWNw.png')

これをもたらします:

失敗した画像付きの Facebook ウォール投稿

Facebook API を使用してウォール投稿に画像を埋め込むにはどうすればよいですか?

4

1 に答える 1

4

添付ファイルを介してlinkフィールドではなくフィールドを使用するmessage

def put_wall_post(self, message, attachment={}, profile_id="me"):
    """Writes a wall post to the given profile's wall.

    We default to writing to the authenticated user's wall if no
    profile_id is specified.

    attachment adds a structured attachment to the status message
    being posted to the Wall. It should be a dictionary of the form:

        {"name": "Link name"
         "link": "http://www.example.com/",
         "caption": "{*actor*} posted a new review",
         "description": "This is a longer description of the attachment",
         "picture": "http://www.example.com/thumbnail.jpg"}

    """
    return self.put_object(profile_id, "feed", message=message,
                           **attachment)

https://github.com/pythonforfacebook/facebook-sdk/blob/master/facebook.py#L142

http://developers.facebook.com/docs/reference/api/user/#links

于 2013-01-14T00:07:42.323 に答える