Skip to content

About

YouTube Shorts scraper for Node.js that flags likely paid placements: send channel handles from a backend or serverless job, get one scored JSON object per Short with the trigger phrases and brand tokens, ready for webhooks. JavaScript example for the Devil Scrapes Apify Actor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

1 Commit

Folders and files

Repository files navigation

YouTube Shorts Sponsorship Signals Scraper β€” JavaScript example

YouTube Shorts Scraper for Node.js: flag paid placements and push them to your app

Run on Apify JavaScript MIT license CI

This repo shows how to call the YouTube Shorts Sponsorship Signals Scraper from Node.js with the official apify-client. Your service posts a list of channel handles, Apify does the listing, metadata and transcript work in the cloud, and you receive plain objects: one per Short, each with a numeric score, a boolean verdict, the phrases that triggered it and any brand tokens found. That shape fits a brand-safety dashboard, an influencer CRM or a Slack bot that pings the partnerships team when a competitor shows up in someone's vertical videos. The script also writes results.json and results.csv for quick inspection.

Actor: YouTube Shorts Sponsorship Signals Scraper Β· Publisher: Devil Scrapes Β· Also in Python: youtube-shorts-scraper-python

πŸ”₯ What you get

  • Speech is read, not just captions: for each Short the Actor pulls the spoken transcript (your language first, English second) and searches it together with the title and description, because a Short's description box is frequently blank.
  • A score you can recompute by hand: strong phrases such as use code add 0.5, softer ones such as link in bio add 0.15, a disclosure hashtag like #ad adds 0.4 and each @handle or shop-style domain in the description adds 0.1. The sum is capped at 1.0 and 0.5 or higher sets is_likely_sponsored.
  • Evidence on every row: sponsorship_signals holds the exact strings that matched, so a reviewer checks a verdict in seconds instead of rewatching the clip.
  • Brand tokens pulled out: detected_brands collects description handles, domains and the word right after sponsored by or code; that last kind is taken from lowercased text, so expect nordvpn rather than NordVPN.
  • Silent Shorts still count: a clip without captions yields a row with has_transcript false, scored only on its written text.
  • Filter before you pay: Shorts under minSponsorshipScore are dropped inside the run and never charged.
  • Many handles in one run: a channel that cannot be listed is logged and skipped while the others continue.

🎯 Use cases

Competitor sponsor alerts

Run the Actor nightly from a scheduled function over the creators in your category and send any object whose detected_brands includes a rival's name to a webhook. The partnerships team hears about a new deal the morning after it airs.

Creator vetting inside an onboarding flow

When an influencer applies through your platform, kick off a run for their handle from the signup handler, store the scored objects and show reviewers the flagged share next to the application.

Disclosure checks as an API endpoint

Wrap the call in an Express or Fastify route that returns only Shorts with spoken sponsor phrases and no disclosure hashtag. Compliance staff paste a handle and get a short reading list back.

Feed a brand-mention index

Upsert each object into Postgres keyed on video_id and index detected_brands as an array column. Queries such as "every Short that mentioned this domain" become one SQL line.

⚑ Quick start

You need an Apify account and an API token from Console β†’ Settings β†’ Integrations. Apify's free plan includes monthly usage credit; this Actor's event prices are listed under Pricing below.

git clone https://github.com/devilscrapes/youtube-shorts-scraper-javascript.git
cd youtube-shorts-scraper-javascript
npm install
export APIFY_TOKEN=your_token_here
node index.js                       # uses input.json
node index.js my-input.json --out data --max-charge 2

The script starts the YouTube Shorts Sponsorship Signals Scraper, waits for it to finish, prints a link to the run in Apify Console and saves every result to results.json and results.csv. It exits with code 1 and the run's status message if the run fails.

🧩 The core call

Here is the whole integration without the CLI wrapper. call() resolves after the run completes, and listItems() reads the Shorts from the dataset the run created.

import { ApifyClient } from 'apify-client';

const client = new ApifyClient({ token: 'YOUR_APIFY_TOKEN' });
const run = await client.actor('DevilScrapes/youtube-shorts-sponsorship-signals').call({"channels": ["@GoPro"], "maxShortsPerChannel": 10, "language": "en", "minSponsorshipScore": 0.0, "proxyConfiguration": {"useApifyProxy": false}});
const { items } = await client.dataset(run.defaultDatasetId).listItems();
console.log(items);

πŸ“₯ Input

index.js forwards input.json exactly as it is. The sample inspects ten recent Shorts from GoPro's official channel with no score threshold and no proxy, so the first run is quick and cheap. To return only the clips a human should review, raise minSponsorshipScore to 0.5.

{
  "channels": [
    "@GoPro"
  ],
  "maxShortsPerChannel": 10,
  "language": "en",
  "minSponsorshipScore": 0.0,
  "proxyConfiguration": {
    "useApifyProxy": false
  }
}
Field Type Required Default Allowed values
channels array yes ["@mkbhd"] β€”
maxShortsPerChannel integer no 20 β€”
language string no "en" β€”
minSponsorshipScore number no 0.0 β€”
proxyConfiguration object no {"useApifyProxy": false} β€”

πŸ“€ Output

Each object is one Short. Array fields (hashtags, mentions, detected_brands, sponsorship_signals, tags) are always arrays, possibly empty, so .includes() works without null checks. view_count, length_seconds and published_text can be null when YouTube's metadata comes back empty.

Field Type Always present
channel string yes
video_id string yes
url string yes
title string yes
published_text string or null no
view_count integer or null no
length_seconds integer or null no
description string no
tags array no
has_transcript boolean yes
transcript_chars integer no
hashtags array no
mentions array no
detected_brands array no
sponsorship_signals array no
sponsorship_score number yes
is_likely_sponsored boolean yes
scraped_at string no

πŸ’° Pricing

Event Price (USD)
Actor start $0.2
Result emitted $0.004

Prices as configured on 2026-08-20. The Actor page always shows the current price. Runs are billed to the Apify account that owns the token. Use --max-charge to cap what a single run can cost.

πŸ› οΈ Working with the data in JavaScript

A small notifier built on Node built-ins only. It keeps the Shorts at or above 0.5, formats one line per hit and posts them to the URL in WEBHOOK_URL, or prints them when that variable is unset.

import { readFile } from 'node:fs/promises';

const shorts = JSON.parse(await readFile('results.json', 'utf8'));
const hits = shorts
    .filter((s) => s.is_likely_sponsored)
    .sort((a, b) => (b.view_count ?? 0) - (a.view_count ?? 0));

const lines = hits.map((s) => {
    const brands = s.detected_brands.length ? s.detected_brands.join(', ') : 'no brand token';
    return `${s.channel} | score ${s.sponsorship_score} | ${brands} | ${s.sponsorship_signals.join(' + ')} | ${s.url}`;
});

if (process.env.WEBHOOK_URL && lines.length) {
    const res = await fetch(process.env.WEBHOOK_URL, {
        method: 'POST',
        headers: { 'content-type': 'application/json' },
        body: JSON.stringify({ text: lines.join('\n') }),
    });
    console.log(`webhook answered ${res.status} for ${lines.length} flagged Shorts`);
} else {
    console.log(lines.join('\n') || 'nothing above 0.5 this time');
}

❓ FAQ

Is this the YouTube Data API?

No. You do not need a Google Cloud project or quota. The only credential is your Apify token; the Actor reads public YouTube pages and transcripts on its own side.

Can I call it from a serverless function with a short timeout?

Use client.actor(...).start() instead of call(), return immediately and let an Apify webhook hit your function when the run finishes. Fetch the dataset items in that second invocation.

Why is a brand token lowercase or odd-looking?

Words that follow sponsored by or code are read from a lowercased copy of the title, description and transcript, and the word after code is sometimes the discount code itself rather than the company. Normalise or map them in your own code before reporting.

Am I billed for Shorts that score below my threshold?

No. Rows under minSponsorshipScore are discarded before they reach the dataset, and only stored rows trigger the per-result charge. The run start fee still applies.

🧯 Troubleshooting

  • Set APIFY_TOKEN first: export the token in the same shell, or put it in a local .env file your shell loads. Never commit it.
  • Run finished with FAILED or ABORTED: open the printed Console link; the run log says why. Input validation errors name the field.
  • Fewer rows than expected: a --max-charge cap also limits how many results can be charged. Raise the cap or lower the limits in your input.
  • Something looks wrong in the data: open an issue on the Actor page so the maintainers see it.

πŸ”— More from Devil Scrapes

Related Actors:


MIT licensed example code. The Actor itself runs on Apify and is maintained by Devil Scrapes. Not affiliated with YouTube or Google LLC.

About

YouTube Shorts scraper for Node.js that flags likely paid placements: send channel handles from a backend or serverless job, get one scored JSON object per Short with the trigger phrases and brand tokens, ready for webhooks. JavaScript example for the Devil Scrapes Apify Actor.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages