---
title: "Track brand mentions across Reddit, X, TikTok and YouTube in 50 lines"
description: "A complete Node script that finds new mentions of your brand on four platforms, dedupes them and prints a digest. About five credits a run, so hourly checks cost a few dollars a month."
canonical_url: https://groundsocial.dev/blog/track-brand-mentions-reddit-x-tiktok-youtube
---
# Track brand mentions across Reddit, X, TikTok and YouTube in 50 lines

> A complete Node script that finds new mentions of your brand on four platforms, dedupes them and prints a digest. About five credits a run, so hourly checks cost a few dollars a month.

_Published 2026-11-26, updated 2026-11-26._

Social listening tools start at a few hundred dollars a month. If what you actually need is “tell me when someone talks about us”, that is four search calls and a file to remember what you have already seen. Here is the whole thing.

## What it does

- **Reddit**: newest posts matching your brand (`reddit.search.posts`, sorted by new).
- **YouTube**: videos uploaded this week (`youtube.search.videos` with `upload_date: week`).
- **TikTok**: videos matching the query (`tiktok.search.videos`), kept if they are under a week old.
- **X**: posts on x.com that Google indexed in the last day (`google.search.web` with `site:x.com` and `tbs: qdr:d`). More on why below.
- It normalises each hit to `{ id, at, author, text, url }`, skips anything older than a week or already seen, prints the rest and saves the seen ids to a JSON file.

## The script

Node 18 or later, no dependencies. Put your key in `GROUNDSOCIAL_API_KEY`. [Get a key](https://groundsocial.dev/app/sign-in?new=1): 100 free credits, no card.

mentions.mjs:

```ts
// node mentions.mjs "your brand"   (Node 18+, GROUNDSOCIAL_API_KEY in the environment)
import { existsSync, readFileSync, writeFileSync } from 'node:fs'

const BRAND = process.argv[2] ?? 'supabase'
const headers = { Authorization: `Bearer ${process.env.GROUNDSOCIAL_API_KEY}` }

async function get(path, params) {
  const res = await fetch(`https://api.groundsocial.dev/v1${path}?${new URLSearchParams(params)}`, { headers })
  const body = await res.json()
  if (!res.ok) throw new Error(`${path}: ${body.error.code}: ${body.error.hint}`)
  return body
}

const sources = {
  reddit: async () => (await get('/reddit/search/posts', { q: BRAND, sort: 'new', limit: 50 }))
    .data.children.map(({ data: p }) => ({ id: p.id, at: p.created_utc, author: p.author,
      text: p.title, url: `https://www.reddit.com${p.permalink}` })),
  youtube: async () => (await get('/youtube/search', { q: BRAND, type: 'video', upload_date: 'week' }))
    .items.map((v) => ({ id: v.id.videoId, at: Date.parse(v.snippet.publishedAt) / 1000,
      author: v.snippet.channelTitle ?? '?', text: v.snippet.title, url: `https://youtu.be/${v.id.videoId}` })),
  tiktok: async () => (await get('/tiktok/search/videos', { q: BRAND }))
    .itemList.map((v) => ({ id: v.id, at: v.createTime, author: v.author.uniqueId,
      text: v.desc, url: `https://www.tiktok.com/@${v.author.uniqueId}/video/${v.id}` })),
  // X search reads X's logged-in app and is not switched on yet; Google's index of x.com is.
  x: async () => ((await get('/google/search', { q: `site:x.com ${BRAND}`, tbs: 'qdr:d' })).organic ?? [])
    .filter((r) => /x\.com\/\w+\/status\/\d+/.test(r.link))
    .map((r) => ({ id: r.link.split('/status/')[1], at: Date.now() / 1000,
      author: r.link.split('/')[3], text: r.snippet, url: r.link })),
}

const seenFile = `seen-${BRAND.replace(/\W+/g, '-')}.json`
const seen = new Set(existsSync(seenFile) ? JSON.parse(readFileSync(seenFile, 'utf8')) : [])
const weekAgo = Date.now() / 1000 - 7 * 86400

for (const [platform, fetchMentions] of Object.entries(sources)) {
  const mentions = await fetchMentions().catch((e) => (console.error(e.message), []))
  for (const m of mentions) {
    if (seen.has(`${platform}:${m.id}`) || m.at < weekAgo) continue
    seen.add(`${platform}:${m.id}`)
    console.log(`[${platform}] ${m.author}: ${m.text.replace(/\s+/g, ' ').slice(0, 90)}\n  ${m.url}`)
  }
}
writeFileSync(seenFile, JSON.stringify([...seen]))
```

## Run it

```bash
export GROUNDSOCIAL_API_KEY=gs_live_...
node mentions.mjs supabase
```

The first run on 26 November 2026 printed 63 mentions from the past week: 35 Reddit posts, 16 YouTube videos, 11 TikToks and one X post. A few of them:

```text
[reddit] fervent7: PostgreSQL persistent task queue: concurrency, idempotency and restart recovery
  https://www.reddit.com/r/codereview/comments/1y6b5t7/postgresql_persistent_task_queue_concurrency/
[youtube] James NoCode: Learn 90% Of Supabase In Under 25 Minutes (2026 Tutorial)
  https://youtu.be/Pp6aTBoD0DM
[tiktok] jordanrobertsai: What is Supabase? It’s where your app keeps its data: clients, bookings, messages. Free to
  https://www.tiktok.com/@jordanrobertsai/video/7712566284847697174
[x] supabase: Supabase@supabaseFollow. The Postgres development platform. supabase.com ⭐️ github.com/sup
  https://x.com/supabase/status/2125734115026640996
```

The second run, a few minutes later, printed only the six posts that had appeared in between. That is the point of the seen file.

## What it costs

| Call | Credits |
| --- | --- |
| Reddit search | 2 |
| YouTube search | 1 |
| TikTok search | 1 |
| Google search (X posts) | 1 |
| **One run** | **5** |

Hourly from cron is 3,600 credits a month: $3.60 on the $10.00 for 10,000 credits pack, less on bigger ones. Failed calls are refunded, and credits do not expire.

```bash
0 * * * * cd ~/mentions && node mentions.mjs supabase >> digest.log
```

## Why X goes through Google

We have an X search endpoint (`x.search.tweets`, 10 credits) but it reads X’s logged-in web app, and it is not switched on yet: today it answers `503 upstream_unavailable` and charges nothing. Until it is, Google’s index of x.com is a good-enough net for a daily digest. It misses posts Google has not crawled, and it cannot see replies well. If X matters most to you, add the accounts you care about with `x.user.tweets` (1 credit for their latest posts) and filter those for your name.

## Making it better

- Cut noise on Reddit with `match: exact` (the phrase must appear in the title or text) or `subreddit` to stay in your niche.
- Add comments: `reddit.search.comments` finds the mentions buried in threads, which is where most honest feedback lives.
- Send the digest to Slack: replace `console.log` with a POST to an incoming webhook.
- Score it: pass each new mention to a model with “is this a question, a complaint, praise or noise?” and only alert on the first two.
- Add Bluesky (`bluesky.search.posts`) and Threads (`threads.search.posts`), one credit each, with the same four-line mapping.

> Examples run against the live Groundsocial API on 2026-11-26. Reddit is a trademark of Reddit, Inc. We are not affiliated with or endorsed by Reddit. X is a trademark of X Corp. We are not affiliated with or endorsed by X Corp. TikTok is a trademark of ByteDance Ltd. We are not affiliated with or endorsed by TikTok or ByteDance. YouTube is a trademark of Google LLC. We are not affiliated with or endorsed by Google or YouTube. Google is a trademark of Google LLC. We are not affiliated with or endorsed by Google.

_Canonical HTML: https://groundsocial.dev/blog/track-brand-mentions-reddit-x-tiktok-youtube_

## Site Navigation

### Global Hub
- [Home](https://groundsocial.dev/index.md)
- [Pricing](https://groundsocial.dev/pricing.md)
- [Endpoints](https://groundsocial.dev/endpoints.md)
- [For agents](https://groundsocial.dev/agents.md)
- [Docs](https://groundsocial.dev/docs.md)
- [Compare](https://groundsocial.dev/compare.md)
- [Blog](https://groundsocial.dev/blog.md)
- [Tutorials](https://groundsocial.dev/tutorials.md)
- [Changelog](https://groundsocial.dev/changelog.md)
- [llms.txt](https://groundsocial.dev/llms.txt)
- [Agent skill](https://groundsocial.dev/SKILL.md)

### On This Topic
- [Blog](https://groundsocial.dev/blog.md)
- [Give Claude and Cursor live social data with one MCP server](https://groundsocial.dev/blog/claude-cursor-live-social-data-mcp.md)
- [Building a creator-analytics dashboard](https://groundsocial.dev/blog/creator-analytics-dashboard.md)
- [Reddit API pricing in 2026 and the alternatives](https://groundsocial.dev/blog/reddit-api-pricing-2026.md)
- [X API pricing in 2026 and the alternatives](https://groundsocial.dev/blog/x-api-pricing-2026.md)
- [Google SERP API price per 1,000 searches, compared](https://groundsocial.dev/blog/google-serp-api-price-per-1000.md)

## Structured data

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https://groundsocial.dev/"},{"@type":"ListItem","position":2,"name":"Blog","item":"https://groundsocial.dev/blog"},{"@type":"ListItem","position":3,"name":"Track brand mentions across Reddit, X, TikTok and YouTube in 50 lines","item":"https://groundsocial.dev/blog/track-brand-mentions-reddit-x-tiktok-youtube"}]}
```
