jsonscraper
Markets
Back to journal

TikTok: Turn Search Results into a Weekly Support Topic List

A Python script collects matching videos, normalizes both API response formats, and creates a spreadsheet for manual review of customer questions.

Editorial Policy Report an error

Support teams need a list of public TikTok videos where people discuss a confusing feature or ask questions about a product. Manual searches are difficult to repeat consistently, and search API responses may store videos in different parts of the JSON. Here is a minimal Python script that requests results by keyword, combines both structures, removes duplicates by ID, and saves the matching records to a CSV.

What the script produces

The result is a table with the video ID, link, description, publication time, author, and available reaction counts. Support or marketing teams can manually mark which topics call for a response, an updated guide, or a check against their own CRM. The table reflects only the API results returned for the specified queries; treat it as a working sample for review, not a comprehensive catalog of all discussions.

Article: TikTok: Turn Search Results into a Weekly Support Topic List
Summary: Set up recurring collection of TikTok videos for product-related searches and get a deduplicated CSV with links, descriptions, and available public metrics. The list helps support teams review topics to check against existing resources and customer inquiries.
Image role: cover — the central idea
Section: What the script produces
Visual subject: Editorial photo, physical
Repeated matching videos are collected into a reviewable support-topic queue.© jsonscraper · AI-generated

The script handles collection and initial sorting. It does not automatically determine whether a description is a question, complaint, or joke: it is better to add such a label after manual review or with a separate classifier, recording the original text and the reason for the decision.

What to request and how the response is structured

For video search, jsonscraper documents the GET route /searchVideo on the host https://tiktok.evelode.com. The required parameter is keyword; you can also pass count, region, sorting, publication period, and a cursor for the next page. For example, you can repeat the search for several predefined phrases: a feature name, a common wording for an error, and a short question about setup. The parameters and their accepted values are listed in the TikTok API reference.

Search has an important detail for parsers: the aweme_list array may be empty while the matching objects are in search_item_list, with each containing aweme_info. The handler below therefore checks both formats. An example response and the fields observed in a check on October 25, 2026, are included in the jsonscraper primary specification; statistics fields may be absent, so the code does not insert made-up values.

Prepare a key and a list of queries

Store the key in the JSONSCRAPER_TIKTOK_LICENSE_KEY environment variable rather than in the source file. In a Linux or macOS shell, you can do this as follows:

export JSONSCRAPER_TIKTOK_LICENSE_KEY="your_key"

Install the requests library and prepare a queries.txt file with one search phrase per line, such as product name setup and feature name not working. Choose phrases in the audience's language and keep them in a separate list so that weekly exports compare the same queries.

python -m pip install requests

Collect and normalize matching videos

The example is compatible with Python 3.8+. It makes one request per phrase with a result limit, checks for HTTP errors and the top-level status, then saves only fields that are actually present. Duplicate matches are combined by aweme_id, and every query that found a video is recorded in the keywords field. A separate collected_at_utc field records when the data was retrieved so you can compare subsequent runs.

Article: TikTok: Turn Search Results into a Weekly Support Topic List
Summary: Set up recurring collection of TikTok videos for product-related searches and get a deduplicated CSV with links, descriptions, and available public metrics. The list helps support teams review topics to check against existing resources and customer inquiries.
Image role: supporting illustration 2 — a different specific aspect
Section: Collect and normalize matching videos
The diagram shows both search-response structures, combining query labels, and recording the collection time before exporting to CSV.© jsonscraper · AI-generated illustration
import csv
import os
import sys
from datetime import datetime, timezone

import requests

BASE_URL = "https://tiktok.evelode.com/searchVideo"
API_KEY = os.environ.get("JSONSCRAPER_TIKTOK_LICENSE_KEY")

if not API_KEY:
    raise SystemExit("Set JSONSCRAPER_TIKTOK_LICENSE_KEY")


def get_items(tiktok):
    """Extract videos from both documented search-response formats."""
    items = list(tiktok.get("aweme_list") or [])
    for entry in tiktok.get("search_item_list") or []:
        info = entry.get("aweme_info") if isinstance(entry, dict) else None
        if info:
            items.append(info)
    return items


with open("queries.txt", encoding="utf-8") as query_file:
    queries = [line.strip() for line in query_file if line.strip()]

collected_at = datetime.now(timezone.utc).isoformat()
videos = {}

for keyword in queries:
    response = requests.get(
        BASE_URL,
        params={
            "license_key": API_KEY,
            "keyword": keyword,
            "count": 30,
            "region": "US",
            "sort_by": "relevance",
        },
        timeout=30,
    )
    response.raise_for_status()
    payload = response.json()

    if payload.get("status") != "ok":
        print("API returned an unsuccessful status for query:", keyword, file=sys.stderr)
        continue

    tiktok = payload.get("tiktok") or {}
    for item in get_items(tiktok):
        video_id = item.get("aweme_id")
        if not video_id:
            continue

        if video_id not in videos:
            author = item.get("author") or {}
            stats = item.get("statistics") or {}
            videos[video_id] = {
                "aweme_id": video_id,
                "keywords": [keyword],
                "description": item.get("desc"),
                "share_url": item.get("share_url"),
                "create_time": item.get("create_time"),
                "author": author.get("unique_id") or author.get("nickname"),
                "play_count": stats.get("play_count"),
                "digg_count": stats.get("digg_count"),
                "comment_count": stats.get("comment_count"),
                "share_count": stats.get("share_count"),
                "collected_at_utc": collected_at,
            }
        elif keyword not in videos[video_id]["keywords"]:
            videos[video_id]["keywords"].append(keyword)

columns = [
    "aweme_id", "keywords", "description", "share_url", "create_time",
    "author", "play_count", "digg_count", "comment_count", "share_count",
    "collected_at_utc",
]
with open("tiktok_support_review.csv", "w", newline="", encoding="utf-8-sig") as output:
    writer = csv.DictWriter(output, fieldnames=columns)
    writer.writeheader()
    for video in videos.values():
        row = dict(video)
        row["keywords"] = " | ".join(row["keywords"])
        writer.writerow(row)

print("Unique matching videos saved:", len(videos))

The request is sent through the params parameter, so the library correctly encodes text phrases in the URL. The key is included in a query parameter, as described in the documentation; do not print the full request URL in application logs. For troubleshooting, record the HTTP response code, search phrase, and run time, but exclude secrets and personal data that are not needed for the task.

How to read the CSV without drawing false conclusions

The keywords column contains every phrase that found a video; collected_at_utc lets you distinguish the publication time from the collection time. The ID is useful for deduplication, and the link lets a person verify the result. An empty counter means the field was missing from that particular response, not that its value was zero.

For initial sorting, add columns to your working copy of the CSV for topic, signal type, response needed, and link to internal resource. Topic options should match your product, for example setup, billing, compatibility, or troubleshooting. This structure turns the export into a review queue while preserving the ability to check a decision against the original video.

Schedule the collection

First run the script manually and check several rows and links. Then add it to cron, a CI task, or an automation workflow that can run a Python process. For regular reports, save each export or add rows to a data store with a unique video key and snapshot date. This lets the team distinguish newly found posts from repeat observations and track changes in available counters between runs.

The cursor parameter is intended for paging through results; it must be passed from the previous call's response. Pagination is deliberately omitted from this minimal example: a limited set of queries is easier to check and reproduce. If you add pages, store the cursor as an opaque value, stop according to the continuation flag, and set an upper limit on calls per run. The API request returns a sample; do not interpret the number of rows as complete TikTok coverage.

Practical limitations

Search results are suitable for finding videos using phrases the team already knows. They help gather material for classification, but do not replace incoming inquiries, analytics from your own website, or checking the video's context. The description may not capture the point of the video, and available metrics reflect the data at the time of retrieval. Record topics and conclusions separately from the source fields so employees can revisit the classification.

Before starting regular monitoring, decide who can access the export, how long data will be retained, and what purpose public information will serve. Store only the fields needed for product review, and prefer links to original posts over copying media files. To request and review available integration options, consult the TikTok Scraper API page and the search-route documentation.

People

No people listed for this article yet.

Keep readingHow to Verify TikTok Leads on IG Before Adding Them to a CRM
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