Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get tweet url having only tweet id

Tags:

How can I get tweet URL having only the tweet id?

I found a solution but I want to know if there is a better one. First, I assume you have to do a query and search after the tweet id obtaining the user name, and after that build the URL as follows:

https://twitter.com/{username}/status/{tweetid}.

Is this correct? Is there an easier solution which doesn't imply doing the query first?

like image 365
Jones Avatar asked Jan 08 '15 08:01

Jones


People also ask

How do you get tweets from Tweet ID?

You don't need to use the API or know the user account. Just drop it into the following URL format, where XXXXXXXXX is the tweet id.

How do you find the URL of a specific Tweet?

Tap the share icon then tap Tweet this Moment to see the URL in the Tweet compose view. From this menu pop-up you also have the option to copy the URL link. Click on the Moment and find its URL in the address bar of your web browser.

What is a Tweet status ID?

Today, Twitter IDs are unique 64-bit unsigned integers, which are based on time, instead of being sequential. The full ID is composed of a timestamp, a worker number, and a sequence number.


2 Answers

It appears that https://twitter.com/statuses/{tweetid} suggested by anas-eqal no longer works consistently. Thus, I went hunting for an alternative. I concede that the accepted response, as of the time of this reply, works perfectly well. However, for my use case I needed a url that avoids a redirect and has a more consistent structure.

Here is what I came up with:

  1. standard: https://twitter.com/i/web/status/{tweetid}
  2. mobile: https://mobile.twitter.com/i/web/status/{tweetid}

Both variants work well in all my tests to date.

like image 36
user2980690 Avatar answered Oct 09 '22 08:10

user2980690


You don't need the username.

Here's one of my tweets

https://twitter.com/edent/status/552767187694661632

If you replace my Twitter name (edent) with any other random name....

https://twitter.com/barackobama/status/552767187694661632

When you click on that link, Twitter will look up the Status ID and automatically redirect you.

So, don't bother doing the query, just stick any random name in there and it will still work.

like image 123
Terence Eden Avatar answered Oct 09 '22 09:10

Terence Eden