Giter Club home page Giter Club logo

youtube-clip-catcher's Introduction

YouTube-clips-banner-new.png

youtube-clip-catcher

youtube-clip-catcher is a Python script designed to fetch and display metadata of a YouTube clip (not a full YouTube video) and download it with custom buffered start and end times.

Given a YouTube clip URL, e.g. https://www.youtube.com/clip/<clip-id> this script queries the YouTube APIs to obtain the start and end time codes of the sub-clip in relation to the full video and downloads only that specific segment.

Features

  • Fetches video details using YouTube API.
  • Extracts start and end times of YouTube clips in relation to the full video.
  • The specified segment of the video is downloaded using yt-dlp for the download process and ffmpeg for extraction.

Example

Given a YouTube clip URL:

https://youtube.com/clip/UgkxYimXng8oFu_jEOyBKr5Lx2lv8ELOKcHy?si=bVLQt1Bdnk8AkusH

The script will return the start and end times of the sub-clip in relation to the full video and download that segment.

Usage

  1. Clone the repository:
git clone https://github.com/yourusername/youtube-clip-catcher.git
  1. Install the dependencies:
poetry install
  1. YouTube Data API v3

Next, you need to create a .env file in the root directory of the project. This file will store your YouTube Data API v3 key. Use the following command to create and add your API key to the .env file:

echo "API_KEY=<your-key>" > .env

Ensure your .env file contains your API_KEY key in this format:

API_KEY=<your-key>
  1. Run the script:
poetry run python main.py
  1. Follow the prompts to enter the YouTube clip URL and download the specified segment.

Configuration

The script uses a configuration file config.json to set the desired video buffer:

{
    "desired_video_buffer": 30
}

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

Acknowledgements

TODOs

  • Change the output encoding to H.264.
  • Output the timecode using YT-DLP friendly bash syntax. yt-dlp --download-sections "*HH:MM:SS-HH:MM:SS" [VIDEO_URL]

youtube-clip-catcher's People

Contributors

alexfazio avatar

Stargazers

Chandan kumar yadav avatar Tomas Laurinavicius avatar

Watchers

Kostas Georgiou avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.