# 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.

[![apidojo](/blog/authors/apidojo.png)**Apidojo** *15+ years of experience in data retrieval.*](/blog/authors/apidojo/)

**30 September 2026** Published

**4 min** Read

![Cover card reading 'How to Scrape Tweets by Date Range'](/blog/covers/scrape-tweets-by-date.png)

**To scrape tweets by date range, add `since:` and `until:` to the query in the `searchTerms` input of apidojo’s [Tweet Scraper V2](https://apify.com/apidojo/tweet-scraper), 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](/blog/twitter-search/since-until-operators/).

## 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](https://github.com/igorbrigadir/twitter-advanced-search)).

```
{
  "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](/blog/twitter-search/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](https://apify.com/apidojo/tweet-scraper)). 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](/blog/twitter-scraping/x-replies-vs-search-flow/) 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](/blog/twitter-scraping/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](https://apify.com/apidojo/tweet-scraper)).

```
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](https://apify.com/apidojo/tweet-scraper)).

## 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](https://apify.com/apidojo/twitter-scraper-lite).

## 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](https://docs.x.com/x-api/posts/search)).

## The scrapers behind this

-   [Tweet Scraper V2 Tweets from searches, profiles, Lists and URLs; 49–64 tweets/sec; minimum 50 per query $0.40 / 1K tweets](/scrapers/twitter-scraper/)

## 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](/blog/twitter-scraping/how-to-scrape-twitter/) or the [apidojo Twitter Scraper](/scrapers/twitter-scraper/).

![apidojo](/blog/authors/apidojo.png)

## [Apidojo](/blog/authors/apidojo/)

15+ years of experience in data retrieval.

API Dojo is always ready for you. With 15+ years of experience, data acquisition has never been that easy. Cheapest prices with high availability.

-   🏯 15+ years of experience in data retrieval.
-   💰 Cheapest prices, qualified data.
-   ⚙️ High availability, extreme maintenance.
-   🐉 Hyper communicative, excellent support.

-   [apidojo.io](https://apidojo.io)

## More in this cluster

-   [Scraping X (Twitter) data: guides by task Turning an X search query into structured data: which actor fits each job, what a run costs, and the limits that decide how you batch it.](/blog/twitter-scraping/)
-   [How to rebuild an X conversation tree from replies Replies arrive as a flat list. Two fields, conversationId and inReplyToId, are what turn that list back into the threaded conversation you saw on X.](/blog/twitter-scraping/x-reply-tree/)
-   [How to Scrape Tweets by Keyword To scrape tweets by keyword, put the keyword query in the searchTerms input of apidojo's Tweet Scraper V2 on Apify, set sort and maxItems, and run it.](/blog/twitter-scraping/scrape-tweets-by-keyword/)
-   [How to Scrape Twitter (X) Data in 2026 To scrape Twitter (X) data in 2026, run an X search query through a scraper such as apidojo's Tweet Scraper V2 on Apify, which returns each matching post as.](/blog/twitter-scraping/how-to-scrape-twitter/)
-   [Reading account age in X reply data Every reply carries the responder's account creation date, follower counts and post history. Here is what those fields can and cannot tell you.](/blog/twitter-scraping/x-replier-account-age/)
-   [When the X replies endpoint under-returns A thread that looks busy on X can come back thin from a scrape. Here is how to tell a quiet conversation from a short run, and what the second flow fixes.](/blog/twitter-scraping/x-replies-vs-search-flow/)
