写真付きツイートがあり、TwitterAPIでjsonデータを取得するとします。
その時、extended_entitiesに画像のデータが入っている場合とない場合があると思います。
なぜそのような違いが生じるのでしょうか?
https://twitter.com/masatetu/status/1019631749054136320
はextended_entitiesにデータあり
https://twitter.com/masatetu/status/1019782576154660864
はextended_entitiesにデータなし
気になる質問をクリップする
クリップした質問は、後からいつでもMYページで確認できます。
またクリップした質問に回答があった際、通知やメールを受け取ることができます。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
回答1件
0
ベストアンサー
仕様により固定ツイート(pinned_tweet)の取得はできなかったと思います
https://twittercommunity.com/t/access-pinned-tweet-programatically/87440/3
非公式のエンドポイント叩くと取れます。
https://api.twitter.com/2/timeline/conversation/1019782576154660864.json?include_profile_interstitial_type=1&include_blocking=1&include_blocked_by=1&include_followed_by=1&include_want_retweets=1&include_mute_edge=1&include_can_dm=1&skip_status=1&cards_platform=Web-12&include_cards=1&include_ext_alt_text=true&include_reply_count=1&tweet_mode=extended&include_entities=true&include_user_entities=true&include_ext_media_color=true&send_error_codes=true&count=20&ext=mediaStats%2ChighlightedLabel
{ "globalObjects": { "tweets": { "1019782576154660864": { "created_at": "Thu Jul 19 03:14:47 +0000 2018", "id_str": "1019782576154660864", "full_text": "本日7/19にニュートラム200系第18編成(201-18F)が新潟トランシスから南港検車場に陸送・搬入されました。\n事前に発表のあったラッピング編成の2本目で、色はラッピングのイメージに合わせたピンク、側面は17F同様未ラッピングでの搬入でした。\nまた01~17Fまでとは異なり前面窓上部も色が付いてました https://t.co/iy2NBkek8b", "display_text_range": [ 0, 154 ], "entities": { "media": [ { "id_str": "1019782540696043521", "indices": [ 155, 178 ], "media_url": "http://pbs.twimg.com/media/Dib-0VZVQAEalxS.jpg", "media_url_https": "https://pbs.twimg.com/media/Dib-0VZVQAEalxS.jpg", "url": "https://t.co/iy2NBkek8b", "display_url": "pic.twitter.com/iy2NBkek8b", "expanded_url": "https://twitter.com/masatetu/status/1019782576154660864/photo/1", "type": "photo", "original_info": { "width": 1576, "height": 1104, "focus_rects": [ { "x": 0, "y": 0, "h": 883, "w": 1576 }, { "x": 472, "y": 0, "h": 1104, "w": 1104 }, { "x": 608, "y": 0, "h": 1104, "w": 968 }, { "x": 1024, "y": 0, "h": 1104, "w": 552 }, { "x": 0, "y": 0, "h": 1104, "w": 1576 } ] }, "sizes": { "medium": { "w": 1200, "h": 841, "resize": "fit" }, "thumb": { "w": 150, "h": 150, "resize": "crop" }, "large": { "w": 1576, "h": 1104, "resize": "fit" }, "small": { "w": 680, "h": 476, "resize": "fit" } }, "features": { "medium": { "faces": [] }, "large": { "faces": [] }, "small": { "faces": [] }, "orig": { "faces": [] } } }, { "id_str": "1019782551978663936", "indices": [ 155, 178 ], "media_url": "http://pbs.twimg.com/media/Dib-0_bUYAANOB3.jpg", "media_url_https": "https://pbs.twimg.com/media/Dib-0_bUYAANOB3.jpg", "url": "https://t.co/iy2NBkek8b", "display_url": "pic.twitter.com/iy2NBkek8b", "expanded_url": "https://twitter.com/masatetu/status/1019782576154660864/photo/1", "type": "photo",
※文字数制限のため省略
投稿2018/07/21 05:05
総合スコア284
あなたの回答
tips
太字
斜体
打ち消し線
見出し
引用テキストの挿入
コードの挿入
リンクの挿入
リストの挿入
番号リストの挿入
表の挿入
水平線の挿入
プレビュー
質問の解決につながる回答をしましょう。 サンプルコードなど、より具体的な説明があると質問者の理解の助けになります。 また、読む側のことを考えた、分かりやすい文章を心がけましょう。
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/07/25 15:04