GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - Troules/yt-grep: Grep any video's transcript (YouTube, TikTok, X, Instagram) and jump to the moment. A small Supadata JS SDK demo.

BranchesTags
Open more actions menu

Latest commit

 

History

2 Commits
2 Commits

Folders and files

NameName
Last commit message
Last commit date
src
src
 
 
test
test
 
 
.env.example
.env.example
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
package-lock.json
package-lock.json
 
 
package.json
package.json
 
 
tsconfig.json
tsconfig.json
 
 

Repository files navigation

yt-grep

Powered by Supadata

Find every moment a phrase is said in a video, then jump straight to it.

yt-grep works like grep, but on video transcripts. Give it a YouTube, TikTok, X or Instagram URL and a phrase (or a regex), and it prints each match with its timestamp. On YouTube, each match also gets a link that opens the video at that second.

It's a small, readable example of the Supadata JS SDK (@supadata/js): about 100 lines across two files.

$ yt-grep "https://www.youtube.com/watch?v=dQw4w9WgXcQ" "/give you up|let you down/"
16 match(es) for "/give you up|let you down/" in "Rick Astley - Never Gonna Give You Up (Official Video) (4K Remaster)" [en]

    0:43  ♪ Never gonna give you up ♪
          https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=43s
    0:45  ♪ Never gonna let you down ♪
          https://www.youtube.com/watch?v=dQw4w9WgXcQ&t=45s
    ...

Quick start

  1. Get a free API key at supadata.ai.
  2. Install and run:
git clone https://github.com/Troules/yt-grep.git && cd yt-grep
npm install && npm run build
export SUPADATA_API_KEY=your-key-here
node dist/cli.js "https://youtu.be/dQw4w9WgXcQ" "never gonna"

You can also run npm link once so yt-grep is on your PATH.

Usage

yt-grep <video-url> <query> [options]

  <query> is a case-insensitive phrase, or a regex written as /pattern/.

Options:
  -l, --lang <code>   Preferred transcript language (e.g. en, fr)
  -m, --mode <mode>   native | auto | generate   (default: auto)
      --json          Print matches as JSON
  -h, --help          Show this help

The exit codes follow grep: 0 means there were matches, 1 means none, 2 means an error. Status messages go to stderr, so stdout stays clean for pipes:

yt-grep "$URL" "pricing" --json | jq -r '.matches[].link'

How it uses Supadata

Supadata turns video and social media URLs into transcripts, metadata and structured data through one API. All the API code is in src/cli.ts:

SDK call What it's for
supadata.transcript({ url, lang, mode, text: false }) Fetches timestamped transcript chunks from any supported platform. mode: "auto" falls back to AI transcription when the video has no captions.
supadata.transcript.getJobStatus(jobId) For long media and AI-generated transcripts, transcript() returns a { jobId } instead of the transcript. The CLI polls until the job is completed.
supadata.metadata({ url }) Gets the video title for the header line.
SupadataError A typed error with a machine-readable error code (transcript-unavailable, limit-exceeded, …) and details.

The core pattern, in short:

import { Supadata } from "@supadata/js";

const supadata = new Supadata({ apiKey: process.env.SUPADATA_API_KEY! });

let transcript = await supadata.transcript({ url, text: false });
if ("jobId" in transcript) {
  // poll supadata.transcript.getJobStatus(transcript.jobId) until status === "completed"
}
// transcript.content: [{ text, offset /* ms */, duration, lang }, ...]

Matching and link building live in src/search.ts. They're pure functions, unit-tested without network access (npm test).

Free-plan tip: the free plan has a per-second rate limit, so yt-grep makes its API calls one after the other instead of in parallel.

Development

npm test        # unit tests (node:test, no API key needed)
npm run dev -- "<url>" "<query>"   # run from source with Node's type stripping
npm run build   # compile to dist/

Requires Node.js 22.6 or later.

License

MIT

About

Grep any video's transcript (YouTube, TikTok, X, Instagram) and jump to the moment. A small Supadata JS SDK demo.

Topics

clisupadatatranscripttypescriptyoutube

Resources

Readme
MIT license
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.