How to Scrape Tweets by Date Range
To scrape tweets by date range, add since: and until: to the query in the searchTerms input of apidojo's Tweet Scraper V2, and split long periods into several shorter windows.

To scrape tweets by date range, add since: and until: to the query in the searchTerms input of apidojo’s Tweet Scraper V2, and split long periods into several shorter windows. Splitting is how the actor’s own documentation collects large histories, and it keeps each query inside what X search returns reliably.
This guide shows how to generate date windows, run them in batches, and merge the results without duplicates. The date operators themselves are explained in since: and until: explained.
How Do You Scrape Tweets Between Two Dates?
You scrape tweets between two dates by writing one query with since: set to the first date and until: set to the day after the last date. until: excludes its own date (twitter-advanced-search reference).
{
"searchTerms": ["from:NASA since:2024-01-01 until:2024-07-01"],
"sort": "Latest"
}
This collects NASA’s posts from January to June 2024. The same window typed into X search is covered in how to search tweets by date.
Why Split a Date Range Into Windows?
Split a long date range into windows because one very long query on a busy topic can return fewer posts than several shorter ones. Tweet Scraper V2’s documentation shows a profile history collected as two six-month windows, and notes lower result counts on some queries that use until: (Apify). A window that comes back thin is not always a quiet period, and the same ceiling-first check that diagnoses an X replies run that under-returns applies here. Listed below are the 3 window sizes by volume.
| Topic volume | Window size |
|---|---|
| One account, or a niche keyword | 6 months to 1 year |
| A popular keyword | 1 month |
| A breaking-news or event keyword | 1 day, or a few hours with a UTC time |
How Do You Generate Date Windows in Python?
Generate date windows in Python by stepping from the start date to the end date one month at a time and writing a query per step. Each query uses the same keyword with a different window.
from datetime import date
def month_windows(start: date, end: date):
current = start
while current < end:
nxt = date(current.year + (current.month // 12), current.month % 12 + 1, 1)
yield current, min(nxt, end)
current = nxt
base = '"heat pump" -filter:retweets'
queries = [f"{base} since:{a} until:{b}" for a, b in month_windows(date(2025, 1, 1), date(2026, 1, 1))]
print(len(queries), queries[0])
This produces 12 monthly queries for 2025. The keyword in base follows the same rules as a single-shot run, which how to scrape tweets by keyword sets out.
How Do You Run Date Windows in Batches?
Run the windows in batches of 5, the maximum Tweet Scraper V2 accepts in one run, and start each batch after the previous run finishes. The actor allows one concurrent run (Apify).
from apify_client import ApifyClient
client = ApifyClient("YOUR_APIFY_TOKEN")
tweets = {}
for i in range(0, len(queries), 5):
run = client.actor("apidojo/tweet-scraper").call(run_input={
"searchTerms": queries[i:i + 5],
"includeSearchTerms": True,
"sort": "Latest",
})
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
tweets[item["id"]] = item
print(len(tweets), "unique tweets")
Storing posts in a dictionary keyed by id removes duplicates when windows touch or when sort is Latest + Top. Deduplication and pagination are covered in depth in Twitter scraper pagination.
Should You Use the start and end Inputs?
Use since: and until: in the query rather than the separate start and end inputs; the actor’s documentation calls queries the best way to filter by date. The start and end inputs apply only to searchTerms, not to startUrls or twitterHandles (Apify).
What Does a Date-Range Scrape Cost?
A date-range scrape costs $0.40 per 1,000 tweets on Tweet Scraper V2, whatever the number of windows, as long as each query returns at least 50 tweets. 12 monthly windows returning 4,000 tweets each (48,000 in total) cost $19.20. Windows expected to return fewer than 50 tweets belong on Twitter Scraper Unlimited.
Does a Scraper Reach Further Back Than the X API?
A scraper reaches the same history as X web search, back to 2006, while the X API’s recent search stops at 7 days and full-archive search needs pay-per-use access at $0.005 per post. The options are compared in how to get historical tweets with an API (X API docs).
Questions people ask
Can you scrape tweets from a specific hour?
Yes, add a UTC time to the operators: since:2024-11-05_18:00:00_UTC until:2024-11-05_19:00:00_UTC.
Can you scrape a whole account history by date?
Yes, generate yearly or half-yearly windows with from:username and run them in batches of 5.
Why do windows return duplicate tweets?
Windows that share a boundary, or sort: Latest + Top, can return the same post twice; deduplicate on id.
Where do you start?
At how to scrape Twitter data in 2026 or the apidojo Twitter Scraper.