taspinar / twitterscraper

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

Adds 'images_urls' and 'has_video' attributes to tweets #210

Closed rezemika closed 4 years ago

rezemika commented 5 years ago

Hi! I made small modifications to be able to download the images coming with a tweet. I thought it might be useful. :)

By the way, it's related to #200.

Now, a Tweet object contains:

It is currently not possible to get the video url, because it does not come with the tweet HTML (it seems to be added after loading with Javascript).

Edit: Videos are added by an obfuscated script, which uses an API requiring parameters which are very difficult to get (they're hidden in an unreadable bloat of JS). The URL of the API is something like https://api.twitter.com/1.1/videos/tweet/config/XXX.json (with XXX = the ID of the tweet), it requires an authorization header and some cookies.

taspinar commented 4 years ago

@rezemika This looks like an useful addition, but don't you want to write the retrieved information to the output file?

rezemika commented 4 years ago

Oh, my bad, I forgot that. It should be fixed now. :)

nukopy commented 4 years ago

This PR should be closed because the similar changes were merged on #231.