aludvigsson / youtube-caption-fetcher
A PHP package to fetch captions from YouTube videos
Installs: 102
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 1
Open Issues: 0
pkg:composer/aludvigsson/youtube-caption-fetcher
Requires
- php: ^7.4|^8.0
- ext-simplexml: *
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.0
This package is not auto-updated.
Last update: 2025-12-21 16:53:33 UTC
README
A PHP package to fetch captions from YouTube videos.
Installation
You can install the package via composer:
composer require aludvigsson/youtube-caption-fetcher
Usage
use Aludvigsson\YouTubeCaptionFetcher\YouTubeCaptionFetcher; use Aludvigsson\YouTubeCaptionFetcher\CaptionFetcherException; use Aludvigsson\YouTubeCaptionFetcher\InvalidUrlException; $fetcher = new YouTubeCaptionFetcher(); try { $transcript = $fetcher->getTranscript('https://www.youtube.com/watch?v=VIDEO_ID'); $title = $fetcher->getVideoTitle('https://www.youtube.com/watch?v=VIDEO_ID'); echo $title; print_r($transcript); } catch (CaptionFetcherException $e) { echo "An error occurred: " . $e->getMessage(); }