Skip to content

TheDavidJohnson/yt-extract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

yt-extract

Fetch YouTube video metadata via the YouTube Data API v3 and print a table (Markdown by default).

Requirements

  • Python 3.9+
  • A Google Cloud project with the YouTube Data API v3 enabled and an API key restricted to that API.

Installation

From the package directory (or from a parent repo that has this as tools/yt-extract):

pip install -e .

Example from a parent repo's root:

pip install -e tools/yt-extract

With a venv active, the yt-extract command will be on your PATH.

Usage

Set your API key, then pass one or more video IDs:

export YOUTUBE_DATA_API_KEY=your_key
yt-extract dQw4w9WgXcQ
yt-extract VIDEO_ID_1 VIDEO_ID_2

If you don’t pass any IDs, you’ll be prompted to enter them (comma- or space-separated):

yt-extract
# Enter video ID(s), comma- or space-separated: dQw4w9WgXcQ

Output

By default the script prints a Markdown table (id, title, publication date, channel title, view count, like count, comment count, duration), suitable for pasting into docs or viewing in a Markdown renderer. Use --format grid to print an ASCII grid instead.

Videos that are private, deleted, or not found are reported on stderr; the table includes only successfully fetched videos.

API key

  • Read from the YOUTUBE_DATA_API_KEY environment variable.
  • If unset, the tool exits with instructions to set it.
  • Do not commit your API key.

License

This project is licensed under the MIT License. See the LICENSE file for the full text.

About

Extract metadata from one or more YouTube videos from the command line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages