Download the PHP package pazakharov/yii2-youtube-captions-scraper without Composer
On this page you can find all versions of the php package pazakharov/yii2-youtube-captions-scraper. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download pazakharov/yii2-youtube-captions-scraper
More information about pazakharov/yii2-youtube-captions-scraper
Files in pazakharov/yii2-youtube-captions-scraper
Package yii2-youtube-captions-scraper
Short Description Youtube captions (subtitles) scraper
License MIT
Informations about the package yii2-youtube-captions-scraper
Youtube Scraper
The Youtube Scraper is a PHP package that allows you to scrape captions and subtitles from Youtube videos. It uses the Yii 2 framework and the Guzzle HTTP client to make requests to the Youtube API.
Installation
You can install the Youtube Scraper using Composer:
Usage
To use the Youtube Scraper, you first need to create an instance of the YoutubeScraper class and set the languageCode property to the language code of the captions you want to scrape. You can then use the getCaptionsBaseUrl and getSubtitles methods to retrieve the base URL and subtitles, respectively.
Here's an example usage:
In this example, we're scraping the captions (subtitles) for the video with the ID wNzql5TZ-i. The getCaptionsBaseUrl method returns the base URL for the captions, which we then pass to the getSubtitles method to retrieve the subtitles.
Note that the getSubtitles method returns an array of strings, where each string represents a subtitle. You can then use this array to display the subtitles in your application.
For use proxy use .env var HTTPCLIENT_PROXY=http://login:password@domain:port or you can configure and provide own instance of Client to YoutubeScraper class.
Testing and Contributing
The Youtube Scraper includes a test suite to ensure that it works correctly. You can run the tests using the phpunit command:
This will run the test suite and output the results.
The Youtube Scraper follows the PSR-2 coding standards. You can check the code for compliance using the phpcs command:
Fix code by phpcbf
License The Youtube Scraper is licensed under the MIT license. You can use it free of charge and without any restrictions.
All versions of yii2-youtube-captions-scraper with dependencies
yidas/yii2-composer-bower-skip Version *
yiisoft/yii2 Version ~2.0.45
yiisoft/yii2-httpclient Version ^2.0
illuminate/support Version ^8.83
vlucas/phpdotenv Version ^5.6