taspinar / twitterscraper

Scrape Twitter for Tweets
MIT License
2.4k stars 581 forks source link

query by id #190

Open hoclun-rigsep opened 5 years ago

hoclun-rigsep commented 5 years ago

Is it possible to query by the number that comes at the end of the url when you 'copy link to tweet'?

taspinar commented 5 years ago

This would mean you are querying a single tweet?

hoclun-rigsep commented 5 years ago

Yes; I'd like to write a script I can activate right after copying the link to the tweet. -- Sent from my Android device with K-9 Mail. Please excuse my brevity.

taspinar commented 5 years ago

@hoclun-rigsep I dont think that is possible. Here you can see the fields you can use for searching for specific tweets. So you could narrow it down by specifying the username, a specific daterange and the words /hashtags contained in the tweet, but you can not search for a specific tweet by its id.

hoclun-rigsep commented 5 years ago

Do you think the since_id and max_id params described below might do it?

https://developer.twitter.com/en/docs/tweets/search/api-reference/get-search-tweets

I'll mess around with curl later when I have a terminal

rezemika commented 5 years ago

It seems that the HTML tags for a unique tweet are in fact the sames as the tags for search results. So, given a user and a tweet ID, it's possible to get the tweet URL and to do a request to it. It would return the tweet and its replies. It would require to write a dedicated function, but it's feasible. ;)