DEV Community

Cover image for Tracking YouTube Hashtag Trends Without Browser Automation Overhead
Crawler Bros
Crawler Bros

Posted on Fully Autonomous

Tracking YouTube Hashtag Trends Without Browser Automation Overhead

YouTube hashtag pages serve as a central hub for specific content niches, but extracting data from them at scale presents a significant engineering hurdle. The standard approach—automating a browser to scroll through infinite loading lists—is resource-heavy and prone to session timeouts. When a project requires tracking hundreds of hashtags like #webdevelopment or #gaming, the overhead of spinning up headless browsers for every request becomes a bottleneck for both speed and infrastructure costs.

The YouTube Hashtag Scraper addresses this by bypassing browser automation entirely. Instead of rendering the full DOM, it utilizes HTTP requests to interface with YouTube’s internal data structures. This allows for the extraction of regular videos and Shorts directly from the hashtag URL (e.g., youtube.com/hashtag/technology) with minimal latency and high reliability.

Structured Extraction of Regional Content

One of the primary challenges in social media data collection is localization. YouTube serves different results based on the requester’s geographic location and language settings. If you are analyzing a global trend, scraping from a single US-based server provides a skewed dataset.

The market input property in this scraper allows developers to define the gl (country) and hl (language) parameters. This ensures that the results reflect what a user in a specific region, such as "IN" (India), "JP" (Japan), or "BR" (Brazil), would actually see. For developers building SEO monitoring tools, this feature is critical for comparing how hashtags perform across different international markets without managing complex proxy rotation for every specific country.

The input schema requires a hashtags array. You can provide these with or without the # prefix. The scraper then normalizes these inputs and proceeds to fetch the metadata.

Controlling Content Density and Type

Hashtag pages on YouTube are often a mix of long-form videos and vertical Shorts. Depending on the analysis goal, you may only want one or the other. For instance, a researcher studying viral short-form trends might only care about the "Shorts" tab of a hashtag page, while a technical analyst might be looking for long-form tutorials.

The contentType parameter provides three options:

  1. all: Collects everything from both the primary hashtag view and the dedicated Shorts tab.
  2. videos: Filters the results to only include regular, long-form content.
  3. shorts: Focuses exclusively on the vertical video format.

By setting the maxResultsPerHashtag integer, you can cap the collection at a specific number (up to 500 items). Because the scraper uses an HTTP-only approach to paginate through YouTube's InnerTube API, it can reach these higher limits much faster than a script attempting to simulate human scrolling and "Load More" clicks.

Data Schema and Field Limitations

The output format is a flat JSON array where each object represents a single video. A key advantage of this specific tool is the "clean output" philosophy: fields that cannot be populated for a specific item are omitted entirely rather than being returned as null.

For regular videos, you can expect a dataset containing:

  • videoId and title
  • channelName, channelId, and channelUrl
  • viewCountText (e.g., "1.2M views")
  • publishedTimeText and durationText
  • isShort (boolean set to false)

When scraping Shorts, it is important to note that YouTube’s UI does not always expose the same level of metadata on the hashtag landing page as it does for regular videos. For Shorts, fields like publishedTimeText or durationText are often missing from the source data and will therefore be absent from the JSON output. Developers should build their ingestion logic to handle these missing keys gracefully.

Managing Run Costs

Pricing for this tool is based on a pay-per-event model combined with platform infrastructure usage. Each successful "result" (a single video or Short added to the dataset) costs $0.005 on the FREE tier. This price decreases for users in higher tiers: $0.00433 for BRONZE, $0.00367 for SILVER, and $0.003 for GOLD, PLATINUM, and DIAMOND tiers.

There is also a flat charge for the "Actor Start" event, which is $0.005 per GB of memory allocated to the run. Platform usage for the run is billed separately at your Apify plan's rates. By using an HTTP-based approach, the memory requirements are typically much lower than browser-based scrapers, which often require 2GB to 4GB of RAM just to stay stable.

Implementation Workflow

Integrating this into a data pipeline typically follows a standard pattern of input configuration and result retrieval.

  1. Define the Scope: Create a JSON configuration specifying the hashtags and the limit.
{
  "hashtags": ["machinelearning", "python"],
  "maxResultsPerHashtag": 100,
  "contentType": "videos",
  "market": "US"
}
Enter fullscreen mode Exit fullscreen mode
  1. Execute the Scraper: Send the configuration to the Actor. The scraper will process each hashtag sequentially.
  2. Handle Errors: If a hashtag is misspelled or contains no videos, the scraper logs a warning and moves to the next item in the array rather than failing the entire run.
  3. Ingest the Dataset: Once the run completes, the results are available in the default dataset.

Each result includes a scrapedAt ISO 8601 timestamp and a position field, which indicates where the video appeared in the hashtag ranking. This is particularly useful for time-series analysis, allowing you to track if a specific video is climbing or falling in the hashtag's "Top" or "Recent" rankings over several days.

Limitations and Tool Selection

While this scraper is efficient for hashtag-level discovery, it is not designed for deep-crawl metadata. For example, it extracts the viewCountText as it appears on the page (e.g., "50K views") rather than a raw integer. If your project requires exact subscriber counts, video descriptions, or comment threads, this tool should be used as a discovery layer to find videoIds, which can then be passed to a more specialized video details scraper. It also cannot bypass age-restricted content or private videos that are not indexed on public hashtag pages.

By offloading the heavy lifting of pagination and regional parameter management to a specialized Actor, developers can focus on the data analysis rather than the brittle nature of social media DOM structures. Ending a run with a structured dataset of 500 videos for a trending hashtag takes only a few minutes, providing a reliable stream of content for SEO monitoring or competitive research.


Everything above runs on YouTube Hashtag Scraper. Start with a small input and a low result limit before you widen the run -- the output shape is easier to check that way.

Prices quoted above are this Actor's published pay-per-event rates on the Apify Store, read from the Apify platform API on 2026-09-27. Check the Actor page for the current rates.

Top comments (0)