jsonscraper

TikTok Hashtag Monitoring in Python: A Working API Request

Verify the endpoint and parameters in Postman, save API responses, and build an observation history from verified data.

Editorial Policy Report an error

A marketing team notices videos about a new product appearing on TikTok, but checking several hashtags manually every day is difficult. To compare posts and visible metrics over time, they need a repeatable collection process with timestamps, an archive of original responses, and checks for changes.

Article: TikTok Hashtag Monitoring in Python: A Working API Request
Summary: A practical guide to collecting public TikTok videos by hashtag: verify the endpoint, make requests with Python, archive JSON, and process confirmed response fields.
Image role: cover — the central idea
Section: 
Visual subject: Editorial still-life photograph of a printed social analytics timeline beside a smartphone displaying a generic short-video hashtag feed, colored hashtag cards and dated JSON observation she
© jsonscraper · AI-generated illustration

The TikTok Scraper API from jsonscraper is suitable for this kind of prototype: its product page lists endpoints for hashtags, users, videos, and search. The first step is to verify the required endpoint and response format in Postman, then transfer the confirmed configuration to Python. This makes it possible to build a repeatable process that extracts only fields actually present in the response.

The goal: track trends, not just one popular video

A single post with a high view count may attract attention, but for campaign planning it is more useful to understand how many new videos are being found on a topic and how the public metrics of previously found posts change. For example, a sporting goods store may want to assess the flow of videos about a particular type of workout before preparing related creative assets.

Manual checks make comparisons difficult: the result set changes, metrics accumulate, and employees may record them in different formats. If each run's snapshot is saved with its collection time and original JSON, the team gets a history of its own observations and can reprocess the data when the analytics schema changes.

Automation consists of several steps: verify the endpoint and parameters, request data on a schedule, save the response, confirm its structure, and then extract the required fields. The resulting table can be used for charts, topic classification, or reports.

What the API documentation confirms

The TikTok Scraper API page lists the base URL https://tiktok.evelode.com and the Hashtag-class endpoints GET /getHashtagInfo, GET /getHashtagFeed, and GET /getHashtagFeedByID. The page also shows an example request to a different endpoint with the license_key parameter and describes how to configure the key in the Postman collection.

For GET /getHashtagFeed, the official endpoint specification lists the required query parameter (a hashtag URL or tag name), along with the optional cursor, count, region, and cache_timeout parameters. The feed response is expected to contain an array at tiktok.aweme_list; listed item fields include aweme_id, desc, create_time, share_url, author data, and statistics. Some fields may be missing, so check the actual JSON before processing it.

Use the jsonscraper Postman collection to run a test request, inspect the actual response, and obtain a sample for later code validation. Pass license_key for authentication; store the key in an environment variable and do not print it to logs.

First, verify the request in Postman

Start with one test hashtag. In the collection, choose the hashtag feed endpoint, set license_key as described in the documentation, and pass the tag name in query. If needed, add count and the country code in region. Run the request and check the HTTP status, the top-level status field, and the contents of tiktok.aweme_list.

Save a successful response as a test JSON file. Use it to check for a post ID, description, publication time, link, and statistics. Include a field in the analytics schema only after confirming that it arrives in the expected type.

Store the API key in an environment variable, not in the source file. If the key is passed in the URL, redact it when logging requests so the full URL is not written to logs.

A Python client for requesting and archiving data

The endpoint and parameter names below match the published specification: hashtags use query, and authentication is passed through license_key. The example is compatible with Python 3.8+ and saves the original response along with run metadata.

import json
import os
from datetime import datetime, timezone
from pathlib import Path

import requests

BASE_URL = "https://tiktok.evelode.com"
API_KEY = os.environ["JSONSCRAPER_TIKTOK_LICENSE_KEY"]


def fetch_hashtag_feed(hashtag: str) -> dict:
    params = {
        "license_key": API_KEY,
        "query": hashtag,
        "count": 20,
    }
    response = requests.get(
        f"{BASE_URL}/getHashtagFeed",
        params=params,
        timeout=45,
    )
    response.raise_for_status()
    payload = response.json()
    if payload.get("status") != "ok":
        raise RuntimeError("API returned a status other than ok")
    return payload


def archive_response(hashtag: str, payload: dict) -> Path:
    collected_at = datetime.now(timezone.utc).isoformat()
    safe_tag = hashtag.lstrip("#").replace("/", "_")
    output_dir = Path("data/raw") / safe_tag
    output_dir.mkdir(parents=True, exist_ok=True)

    filename = datetime.now(timezone.utc).strftime("%Y%m%dT%H%M%SZ.json")
    file_path = output_dir / filename
    file_path.write_text(
        json.dumps(
            {
                "hashtag": hashtag,
                "collected_at": collected_at,
                "response": payload,
            },
            ensure_ascii=False,
            indent=2,
        ),
        encoding="utf-8",
    )
    return file_path


if __name__ == "__main__":
    tag = "#exampletopic"
    payload = fetch_hashtag_feed(tag)
    saved_path = archive_response(tag, payload)
    print(f"Archive saved: {saved_path}")

Before running the script, set the JSONSCRAPER_TIKTOK_LICENSE_KEY environment variable. The request uses the confirmed query parameter and limits the number of requested items with count. The code checks both the HTTP status and the JSON status; the archive preserves the actual data for later processing. Test it with one hashtag before adding a schedule and analytics.

How to add normalization without brittle assumptions

The feed response is documented as containing the tiktok.aweme_list array. Before transforming the data, check that tiktok is an object and aweme_list is a list. For each item, extract only confirmed fields, such as aweme_id, desc, create_time, share_url, and values from statistics, when present.

An internal table can contain the requested hashtag, collection time, video ID, and selected metrics. Store an empty value for an optional or missing metric: an absent metric is different from a measured zero. Keep the original responses separately so the table can be rebuilt without another request.

If the response format changes, type checks should stop invalid processing and produce a diagnostic message. Keep the test JSON alongside the parser test: it will help verify that a new code version can still handle the known schema.

Metrics based on repeated observations

If the response provides counters, save each observation with a timestamp. For one post, compare the values from two runs and calculate the observed change over the interval. Use aweme_id, which is listed in the specification, to match posts, and check that it is present in each item.

You can count newly discovered posts per day based on the results of your runs. This metric describes the flow returned by specific requests with their given parameters and schedule. It lets you compare your own snapshots when the collection method remains consistent.

A minimal report can show the number of newly discovered posts by day, the distribution of available counters, and changes in values for videos found again. Include the request time and original filename so an analyst can verify the origin of each record.

Scheduling and error handling

Once the request and parsing have been tested, run the script on a schedule—for example, through cron, GitHub Actions, or a data orchestrator. Move the hashtag list into a separate configuration so topics can be added or removed without changing the client logic.

For automated runs, set a timeout, limit retries for temporary network errors, and log the HTTP status and request duration. Do not write the key to the log. If parsing fails, save safe diagnostic details and notify the responsible employee.

The specification supports pagination with the cursor parameter for the hashtag feed. If you need it, save the cursor from the response and pass it unchanged in the next request; process only the returned results and check has_more, if present. If requests for multiple hashtags return the same post, choose a deduplication key based on the task: count the post separately for each hashtag or count only unique videos.

Classification and automated reporting

After obtaining validated rows, you can add classification of video descriptions by specified topics: the item schema lists the desc field. A model can group posts by format—for example, tutorials, reviews, or user experiences. Save the original text, label, instruction version, and result, and send uncertain cases to a person for review.

Calculate numerical metrics with ordinary code so repeated runs produce reproducible arithmetic. A classifier is useful for processing text; the final report should link its conclusions to specific rows and observation dates.

In a no-code workflow, the same steps can be linked in an automation tool: schedule, HTTP request using the verified configuration, response check, JSON storage, transformation of confirmed fields, and error notification. Verify the contract in Postman first, then transfer it to Python, n8n, or Make.

Expected outcome and next step

After setup, the team will have an archive of API responses and an observation table for selected hashtags. These can help find new posts, compare available metrics over time, and select material for substantive analysis. For comparable results, maintain a consistent schedule, request parameters, and normalization rules.

Start with one endpoint and one real response: make a /getHashtagFeed request with the query parameter, save the JSON, then add field parsing and a schedule. The TikTok Scraper API page shows the base URL and endpoint map, while the endpoint specification provides the parameter names for implementing the client.

People

No people listed for this article yet.

Keep readingHow to Archive TikTok Search Results with Python
Read the next article

Turn what you read into a working integration

Explore jsonscraper's social-data APIs, test requests and build your next workflow.

Explore APIs