mahrtayyab / tweety

Twitter Scraper
496 stars 67 forks source link

Issue with Extracting Direct Video URL from Tweets #198

Closed issim91 closed 4 months ago

issim91 commented 4 months ago

I'm trying to get a link to the media (for video), but the URL contains only the short URL of the tweet (https://t.co/OtvCliDFS5)

Apparently, something has changed on Twitter's side, and now clicking on this link redirects me to the tweet.

Is it possible to get a direct link to the video if it is in the tweet content?

mahrtayyab commented 4 months ago

Please post your code snippet

issim91 commented 4 months ago

from tweety import Twitter
from tweety.types import Proxy, twDataTypes

proxy =  Proxy(PROXY_URL, 10000, 3, username=PROXY_USERNAME, password=PROXY_PASSWORD)
app = Twitter('session', proxy=proxy)

all_tweets = app.get_list_tweets(tw_list, pages=1)

for tweet in all_tweets:
    media = []
    for m in tweet.media:
        media.append({
            'type': m.type,
            'url': m.url,
            'preview_image_url': m.media_url_https,
        })

    tweet_format = {
        'id': tweet.id,
        'text': tweet.text,
        'media': media,
    }
mahrtayyab commented 4 months ago

image It could be a temporay issue , it is fine for me right now.

mahrtayyab commented 4 months ago

image Video is okay too.

issim91 commented 4 months ago

Thank you! Video urls from Stream working