Docs


Using Twitter's Search for Time-period scraping


The Twitter Search API allows you to refine your queries using advanced search parameters directly within the query field. These parameters, including date and time filters, are appended as part of the search string to extract highly specific data. Below is a guide on how to utilize them effectively.


Time-period Search Parameters for Query


  • since:[YYYY-MM-DD]
    Specifies the starting date for tweets.
    Example: since:2025-01-06 fetches tweets from January 6, 2025, onwards.
  • until:[YYYY-MM-DD]
    Specifies the ending date for tweets.
    Example: until:2025-01-07 fetches tweets up to January 7, 2025.
  • since_time:[UNIX_TIMESTAMP]
    Specifies the starting date and time for tweets, in UNIX timestamp format (seconds since 1970-01-01 00:00:00 UTC).
    Example: since_time:1736169600 fetches tweets starting from 2025-01-06 00:00:00 UTC.
  • until_time:[UNIX_TIMESTAMP]
    Specifies the ending date and time for tweets, in UNIX timestamp format.
    Example: until_time:1736256000 fetches tweets up to 2025-01-07 00:00:00 UTC.
  • Combining Parameters
    Use combinations like since with until, or since_time with until_time, for precise filtering.
    Example: since_time:1736169600 until_time:1736256000 fetches tweets between 2025-01-06 00:00:00 UTC and 2025-01-07 00:00:00 UTC.

Example Search Query

To search for tweets from @elonmusk between January 6, 2025, 00:00 UTC, and January 7, 2025, 00:00 UTC using UNIX timestamps:

https://api.scraper.tech/twitter/search?q=from:elonmusk since_time:1736169600 until_time:1736256000

Tips for Using Query Parameters

  • Combining Filters
    Add additional terms to refine your search.
    Example: from:elonmusk since:2025-01-06 until:2025-01-07 Tesla fetches tweets by @elonmusk about "Tesla" within the specified date range.
  • Case Insensitivity
    Queries are case-insensitive, so from:ElonMusk works the same as from:elonmusk.
  • Time Zone Awareness
    While since and until use UTC dates, since_time and until_time ensure precision with UNIX timestamps.
  • Real-Time Monitoring
    Use since_time without until_time to fetch tweets from a specific point in time moving forward.

Practical Use Cases

  • Event Monitoring
    Extract tweets during a live event using precise timestamps.
    Example: from:elonmusk since_time:1736169600 until_time:1736256000 retrieves Elon Musk’s tweets during January 6, 2025.
  • Topic Tracking
    Find discussions on a topic in specific time intervals.
    Example: from:NASA since_time:1736169600 Mars retrieves NASA’s tweets about Mars from January 6, 2025.
  • Historical Analysis
    Analyze user activity or trends in specific time frames.