为什么这条引用的推文指向它自己?
Why is this quoted tweet pointing to itself?
我正在使用 Twitter API 检索推文,我这样做:
我检查他们是否有 quoted_status,然后我替换 url_info->url
中的 URL,它在 url_info->expanded_url
中有 tweet_data->quoted_status->id_str
。这样,我知道 URL 是引用的推文之一,我可以恢复数据并将其显示在下面。
这通常有效,但不适用于这条推文:
stdClass Object
(
[created_at] => Wed Dec 14 08:30:32 +0000 2016
[id] => 8.0895229853789E+17
[id_str] => 808952298537885696
[text] => Volem felicitar al Centre d'Estudis Montseny, guanyadors d'aquest concurs, i a @stlisieux, que han estat finalistes… 'shortened_url'/CGqkTNPPB1
[truncated] => 1
[entities] => stdClass Object
(
[hashtags] => Array
(
)
[symbols] => Array
(
)
[user_mentions] => Array
(
[0] => stdClass Object
(
[screen_name] => stlisieux
[name] => Col·legi ST Lisieux
[id] => 3064329677
[id_str] => 3064329677
[indices] => Array
(
[0] => 79
[1] => 89
)
)
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'CGqkTNPPB1
[expanded_url] => https://twitter.com/i/web/status/808952298537885696
[display_url] => twitter.com/i/web/status/8…
[indices] => Array
(
[0] => 117
[1] => 140
)
)
)
)
[source] => Twitter Web Client
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => stdClass Object
(
[id] => 493037120
[id_str] => 493037120
[name] => Clickedu
[screen_name] => Clickedu
[location] => España
[description] => La plataforma para colegios e institutos. | La plataforma per a escoles i instituts. 'shortened_url'/NBZbqw7Qpn
[url] => 'shortened_url'/00a8v8WUv5
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/00a8v8WUv5
[expanded_url] => http://www.clickartedu.com/
[display_url] => clickartedu.com
[indices] => Array
(
[0] => 0
[1] => 22
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/NBZbqw7Qpn
[expanded_url] => http://www.clickedu.eu
[display_url] => clickedu.eu
[indices] => Array
(
[0] => 85
[1] => 107
)
)
)
)
)
[protected] =>
[followers_count] => 2960
[friends_count] => 1998
[listed_count] => 79
[created_at] => Wed Feb 15 11:29:55 +0000 2012
[favourites_count] => 8529
[utc_offset] => 3600
[time_zone] => Madrid
[geo_enabled] => 1
[verified] =>
[statuses_count] => 3840
[lang] => ca
[contributors_enabled] =>
[is_translator] =>
[is_translation_enabled] =>
[profile_background_color] => AD0C40
[profile_background_image_url] => http://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg
[profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg
[profile_background_tile] =>
[profile_image_url] => http://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg
[profile_image_url_https] => https://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/493037120/1477042035
[profile_link_color] => AD0C40
[profile_sidebar_border_color] => FFFFFF
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[has_extended_profile] =>
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
[translator_type] => none
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[is_quote_status] => 1
[quoted_status_id] => 8.0870805032451E+17
[quoted_status_id_str] => 808708050324508672
[quoted_status] => stdClass Object
(
[created_at] => Tue Dec 13 16:19:58 +0000 2016
[id] => 8.0870805032451E+17
[id_str] => 808708050324508672
[text] => Aixà és com veuen l’ictus els alumnes del Centre d’Estudis Montseny, que han guanyat el 18è concurs Pinta La Marató… 'shortened_url'/tts4uGmKWy
[truncated] => 1
[entities] => stdClass Object
(
[hashtags] => Array
(
)
[symbols] => Array
(
)
[user_mentions] => Array
(
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/tts4uGmKWy
[expanded_url] => https://twitter.com/i/web/status/808708050324508672
[display_url] => twitter.com/i/web/status/8…
[indices] => Array
(
[0] => 117
[1] => 140
)
)
)
)
[source] => Twitter Web Client
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => stdClass Object
(
[id] => 18045654
[id_str] => 18045654
[name] => La Marató
[screen_name] => la_marato
[location] => Catalunya
[description] => El 18 de desembre La Marató fa 25 anys amb un programa dedicat a l'ictus i les lesions medul·lars i cerebrals traumà tiques.
[url] => 'shortened_url'/iCXlb20x3w
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/iCXlb20x3w
[expanded_url] => http://www.tv3.cat/marato/
[display_url] => tv3.cat/marato/
[indices] => Array
(
[0] => 0
[1] => 22
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
)
)
)
[protected] =>
[followers_count] => 46627
[friends_count] => 352
[listed_count] => 333
[created_at] => Thu Dec 11 11:38:21 +0000 2008
[favourites_count] => 1469
[utc_offset] => 3600
[time_zone] => Madrid
[geo_enabled] =>
[verified] =>
[statuses_count] => 3160
[lang] => ca
[contributors_enabled] =>
[is_translator] =>
[is_translation_enabled] =>
[profile_background_color] => DCE4E8
[profile_background_image_url] => http://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg
[profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg
[profile_background_tile] =>
[profile_image_url] => http://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg
[profile_image_url_https] => https://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/18045654/1481702408
[profile_link_color] => 0084B4
[profile_sidebar_border_color] => FFFFFF
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[has_extended_profile] =>
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
[translator_type] => none
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[is_quote_status] =>
[retweet_count] => 15
[favorite_count] => 21
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => und
)
[retweet_count] => 2
[favorite_count] => 2
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => und
)
在这里,[expanded_url] => https://twitter.com/i/web/status/808952298537885696
指向推文本身,而不是像往常一样指向引用的推文。
这常见吗?
我如何在引用的推文中 link 缩短文本正文中的 URL ?我看不出它们之间有任何联系,所以我不知道如何替换推文内容的 link,因为我不知道如何区分引用的推文 URL 和其他 URL可能在推文中。
由于此推文中的 truncated
值为 true
(1),这表明您正在查看扩展的推文。您可以在 Twitter 开发人员 Upcoming Changes to Tweets 文档中阅读有关新推文格式的更多信息。如果您使用 tweet_mode=extended
选项,您将能够检索完整的推文,而不会将 link 嵌入推文的网络版本。
我正在使用 Twitter API 检索推文,我这样做:
我检查他们是否有 quoted_status,然后我替换 url_info->url
中的 URL,它在 url_info->expanded_url
中有 tweet_data->quoted_status->id_str
。这样,我知道 URL 是引用的推文之一,我可以恢复数据并将其显示在下面。
这通常有效,但不适用于这条推文:
stdClass Object
(
[created_at] => Wed Dec 14 08:30:32 +0000 2016
[id] => 8.0895229853789E+17
[id_str] => 808952298537885696
[text] => Volem felicitar al Centre d'Estudis Montseny, guanyadors d'aquest concurs, i a @stlisieux, que han estat finalistes… 'shortened_url'/CGqkTNPPB1
[truncated] => 1
[entities] => stdClass Object
(
[hashtags] => Array
(
)
[symbols] => Array
(
)
[user_mentions] => Array
(
[0] => stdClass Object
(
[screen_name] => stlisieux
[name] => Col·legi ST Lisieux
[id] => 3064329677
[id_str] => 3064329677
[indices] => Array
(
[0] => 79
[1] => 89
)
)
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'CGqkTNPPB1
[expanded_url] => https://twitter.com/i/web/status/808952298537885696
[display_url] => twitter.com/i/web/status/8…
[indices] => Array
(
[0] => 117
[1] => 140
)
)
)
)
[source] => Twitter Web Client
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => stdClass Object
(
[id] => 493037120
[id_str] => 493037120
[name] => Clickedu
[screen_name] => Clickedu
[location] => España
[description] => La plataforma para colegios e institutos. | La plataforma per a escoles i instituts. 'shortened_url'/NBZbqw7Qpn
[url] => 'shortened_url'/00a8v8WUv5
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/00a8v8WUv5
[expanded_url] => http://www.clickartedu.com/
[display_url] => clickartedu.com
[indices] => Array
(
[0] => 0
[1] => 22
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/NBZbqw7Qpn
[expanded_url] => http://www.clickedu.eu
[display_url] => clickedu.eu
[indices] => Array
(
[0] => 85
[1] => 107
)
)
)
)
)
[protected] =>
[followers_count] => 2960
[friends_count] => 1998
[listed_count] => 79
[created_at] => Wed Feb 15 11:29:55 +0000 2012
[favourites_count] => 8529
[utc_offset] => 3600
[time_zone] => Madrid
[geo_enabled] => 1
[verified] =>
[statuses_count] => 3840
[lang] => ca
[contributors_enabled] =>
[is_translator] =>
[is_translation_enabled] =>
[profile_background_color] => AD0C40
[profile_background_image_url] => http://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg
[profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/444501732022697984/vMM1qgYt.jpeg
[profile_background_tile] =>
[profile_image_url] => http://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg
[profile_image_url_https] => https://pbs.twimg.com/profile_images/567973366670172160/1opAPyhE_normal.jpeg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/493037120/1477042035
[profile_link_color] => AD0C40
[profile_sidebar_border_color] => FFFFFF
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[has_extended_profile] =>
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
[translator_type] => none
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[is_quote_status] => 1
[quoted_status_id] => 8.0870805032451E+17
[quoted_status_id_str] => 808708050324508672
[quoted_status] => stdClass Object
(
[created_at] => Tue Dec 13 16:19:58 +0000 2016
[id] => 8.0870805032451E+17
[id_str] => 808708050324508672
[text] => Aixà és com veuen l’ictus els alumnes del Centre d’Estudis Montseny, que han guanyat el 18è concurs Pinta La Marató… 'shortened_url'/tts4uGmKWy
[truncated] => 1
[entities] => stdClass Object
(
[hashtags] => Array
(
)
[symbols] => Array
(
)
[user_mentions] => Array
(
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/tts4uGmKWy
[expanded_url] => https://twitter.com/i/web/status/808708050324508672
[display_url] => twitter.com/i/web/status/8…
[indices] => Array
(
[0] => 117
[1] => 140
)
)
)
)
[source] => Twitter Web Client
[in_reply_to_status_id] =>
[in_reply_to_status_id_str] =>
[in_reply_to_user_id] =>
[in_reply_to_user_id_str] =>
[in_reply_to_screen_name] =>
[user] => stdClass Object
(
[id] => 18045654
[id_str] => 18045654
[name] => La Marató
[screen_name] => la_marato
[location] => Catalunya
[description] => El 18 de desembre La Marató fa 25 anys amb un programa dedicat a l'ictus i les lesions medul·lars i cerebrals traumà tiques.
[url] => 'shortened_url'/iCXlb20x3w
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => 'shortened_url'/iCXlb20x3w
[expanded_url] => http://www.tv3.cat/marato/
[display_url] => tv3.cat/marato/
[indices] => Array
(
[0] => 0
[1] => 22
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
)
)
)
[protected] =>
[followers_count] => 46627
[friends_count] => 352
[listed_count] => 333
[created_at] => Thu Dec 11 11:38:21 +0000 2008
[favourites_count] => 1469
[utc_offset] => 3600
[time_zone] => Madrid
[geo_enabled] =>
[verified] =>
[statuses_count] => 3160
[lang] => ca
[contributors_enabled] =>
[is_translator] =>
[is_translation_enabled] =>
[profile_background_color] => DCE4E8
[profile_background_image_url] => http://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg
[profile_background_image_url_https] => https://pbs.twimg.com/profile_background_images/378800000099697740/e6dc40b2a9233a582dc14394aed732a7.jpeg
[profile_background_tile] =>
[profile_image_url] => http://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg
[profile_image_url_https] => https://pbs.twimg.com/profile_images/748843776345513985/WXSEA15G_normal.jpg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/18045654/1481702408
[profile_link_color] => 0084B4
[profile_sidebar_border_color] => FFFFFF
[profile_sidebar_fill_color] => DDEEF6
[profile_text_color] => 333333
[profile_use_background_image] => 1
[has_extended_profile] =>
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
[translator_type] => none
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[is_quote_status] =>
[retweet_count] => 15
[favorite_count] => 21
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => und
)
[retweet_count] => 2
[favorite_count] => 2
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => und
)
在这里,[expanded_url] => https://twitter.com/i/web/status/808952298537885696
指向推文本身,而不是像往常一样指向引用的推文。
这常见吗? 我如何在引用的推文中 link 缩短文本正文中的 URL ?我看不出它们之间有任何联系,所以我不知道如何替换推文内容的 link,因为我不知道如何区分引用的推文 URL 和其他 URL可能在推文中。
由于此推文中的 truncated
值为 true
(1),这表明您正在查看扩展的推文。您可以在 Twitter 开发人员 Upcoming Changes to Tweets 文档中阅读有关新推文格式的更多信息。如果您使用 tweet_mode=extended
选项,您将能够检索完整的推文,而不会将 link 嵌入推文的网络版本。