I want to get all tweets from a specific user containing media. I am currently using this library: https://pypi.org/project/twitter/
from twitter import *
def get_posts(user:str):
bearer_token = "a_super_secret_string"
twitter: Twitter = None
twitter = Twitter(auth=OAuth2(bearer_token=bearer_token))
results = self.__twitter.statuses.user_timeline(screen_name=user)
for r in results: # For each result
if "media" in r["entities"]: # That has some media in it
do_something()
This works fine, but it doesn't show me very many tweets. Since the users that I am trying to target with this don't post media with every tweet, by the time the filtering is done I end up with around 10-15 images (where as the account may have posted over 100 total).
Is there a better way to accomplish this?