Skip to content

Instantly share code, notes, and snippets.

@joaomacalos
Created May 1, 2021 13:57
Show Gist options
  • Save joaomacalos/3531504da450d9f6fee30fe7f103c03d to your computer and use it in GitHub Desktop.
Save joaomacalos/3531504da450d9f6fee30fe7f103c03d to your computer and use it in GitHub Desktop.
hashtag2-defapi
# Query
query = "SuperLeague OR #SuperLeague -filter:retweets"
def collect_tweets(query, max_id=None, nitems=100, until=None, result_type='recent'):
if until is not None:
tweets = tweepy.Cursor(api.search,
q=query,
lang="en",
tweet_mode="extended",
result_type=result_type,
timezone='Europe/England',
until=until
).items(nitems)
else:
tweets = tweepy.Cursor(api.search,
q=query,
lang="en",
tweet_mode="extended",
result_type=result_type,
timezone='Europe/England',
max_id=max_id
).items(nitems)
return tweets
@thezakman
Copy link

Fala mestre, estou tentando fazer sua função rodar aqui no tweepy mas não consigo fazer o advanced search rolar como no seu "query".

@joaomacalos
Copy link
Author

joaomacalos commented May 16, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment