Hello,
I have been running into issues with GET user_timeline and not getting the actual URL to the tweet but instead the link provided or image inside the tweet itself? Is there a different way to get this?
To make sure you’re getting the entire tweet payload with all the media or attachments, make sure you have tweet_mode=extended set in the request.
If you need a link to the tweet itself, the actual permalink to a tweet is not directly included in the json but can be constructed from:
https://twitter.com/[user.screen_name]/status/[id_str]
(infact, even a _ will still work, as long as the tweet ID is correct.)
1 Like
In the interim that is what I have been doing is grabbing that URL status but would love a shorter like t.co url. Let me test it with extended added.
Extended mode doesn’t appear to include the URL when you include a link with no media.
Array
(
[0] => stdClass Object
(
[created_at] => Wed Aug 21 14:53:11 +0000 2019
[id] => 1164188704971399168
[id_str] => 1164188704971399168
[full_text] => Test Tweet #3
https://t.co/EVlZtUQ2JV
[truncated] =>
[display_text_range] => Array
(
[0] => 0
[1] => 38
)
[entities] => stdClass Object
(
[hashtags] => Array
(
)
[symbols] => Array
(
)
[user_mentions] => Array
(
)
[urls] => Array
(
[0] => stdClass Object
(
[url] => https://t.co/EVlZtUQ2JV
[expanded_url] => http://mixer.com/PinkMeatBall
[display_url] => mixer.com/PinkMeatBall
[indices] => Array
(
[0] => 15
[1] => 38
)
)
)
)
[source] => <a href="https://mobile.twitter.com" rel="nofollow">Twitter Web App</a>
[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] => 817398262915354624
[id_str] => 817398262915354624
[name] => PinkMeatBall (Code PMB)
[screen_name] => PinkMeatBall
[location] => ✉️ - admin@pinkmeatball.com
[description] => Nerd by day, Content Creator by night! Sponsored by @COUGAROFFICIAL | @ECHOGEAR 15% off "PMBMounts15" | @beta_shades
[url] => https://t.co/7LpV7Snxac
[entities] => stdClass Object
(
[url] => stdClass Object
(
[urls] => Array
(
[0] => stdClass Object
(
[url] => https://t.co/7LpV7Snxac
[expanded_url] => http://mixer.com/PinkMeatBall
[display_url] => mixer.com/PinkMeatBall
[indices] => Array
(
[0] => 0
[1] => 23
)
)
)
)
[description] => stdClass Object
(
[urls] => Array
(
)
)
)
[protected] =>
[followers_count] => 2287
[friends_count] => 569
[listed_count] => 10
[created_at] => Fri Jan 06 15:51:47 +0000 2017
[favourites_count] => 13729
[utc_offset] =>
[time_zone] =>
[geo_enabled] =>
[verified] =>
[statuses_count] => 16692
[lang] =>
[contributors_enabled] =>
[is_translator] =>
[is_translation_enabled] =>
[profile_background_color] => 000000
[profile_background_image_url] => http://abs.twimg.com/images/themes/theme1/bg.png
[profile_background_image_url_https] => https://abs.twimg.com/images/themes/theme1/bg.png
[profile_background_tile] =>
[profile_image_url] => http://pbs.twimg.com/profile_images/1032278808521396226/l2nap73x_normal.jpg
[profile_image_url_https] => https://pbs.twimg.com/profile_images/1032278808521396226/l2nap73x_normal.jpg
[profile_banner_url] => https://pbs.twimg.com/profile_banners/817398262915354624/1531939688
[profile_link_color] => ED008C
[profile_sidebar_border_color] => 000000
[profile_sidebar_fill_color] => 000000
[profile_text_color] => 000000
[profile_use_background_image] =>
[has_extended_profile] => 1
[default_profile] =>
[default_profile_image] =>
[following] =>
[follow_request_sent] =>
[notifications] =>
[translator_type] => none
)
[geo] =>
[coordinates] =>
[place] =>
[contributors] =>
[is_quote_status] =>
[retweet_count] => 0
[favorite_count] => 0
[favorited] =>
[retweeted] =>
[possibly_sensitive] =>
[lang] => fr
)
)
The URL to the tweet itself is not included in the API response. As IgorBrigadir mentioned, you have to construct it yourself.
2 Likes
Awesome I will keep doing it this way thank you:)
1 Like
system
Closed
#7
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.