Use advanced search operators to find tweets by keyword, hashtag, author, date range, language, and more.
Sign up at scrapebadger.com and grab your API key from the dashboard.
Search for tweets containing a keyword or phrase.
from scrapebadger import ScrapeBadger
sb = ScrapeBadger(api_key="YOUR_API_KEY")
results = sb.twitter.tweets.advanced_search(
query="web scraping",
query_type="Latest"
)
for t in results["data"]:
print(f"@{t['author']['username']}: {t['text'][:100]}")Combine operators for precise filtering: from:, since:, lang:, min_faves:, etc.
# Tweets from a specific user with high engagement
results = sb.twitter.tweets.advanced_search(
query='from:elonmusk min_faves:1000 since:2025-01-01 lang:en',
query_type="Top"
)Choose between Top (relevance), Latest (chronological), or Media (images/videos).
# Get media tweets only
media = sb.twitter.tweets.advanced_search(
query="web scraping tutorial",
query_type="Media"
)Use the cursor to get additional pages of search results.
all_tweets = []
cursor = None
for page in range(5): # Get 5 pages
result = sb.twitter.tweets.advanced_search(
query="web scraping API",
query_type="Latest",
cursor=cursor
)
all_tweets.extend(result["data"])
cursor = result.get("next_cursor")
if not cursor:
break
print(f"Found {len(all_tweets)} tweets")Twitter search covers approximately 7-10 days. For older tweets, you need to use specific tweet or user timeline endpoints.
All Twitter advanced search operators: from:, to:, since:, until:, lang:, min_faves:, min_retweets:, filter:media, -filter:replies, and boolean operators (AND, OR).
Yes. Wrap phrases in quotes: "web scraping API" will match the exact phrase, not individual words.
Use the minus operator: "web scraping -spam" excludes tweets containing "spam". Also: -filter:replies removes replies.
Learn how to extract the complete follower list of any Twitter account with profile data, follower counts, and bios.
5 minutesGet complete user profile data — bio, followers, following, tweet count, join date, and verification status — in one API call.
3 minutesSet up real-time monitoring for your brand on Twitter. Get instant webhook alerts when someone mentions your brand or products.
10 minutes