Download the PHP package gregory-gerard/rutube without Composer
On this page you can find all versions of the php package gregory-gerard/rutube. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download gregory-gerard/rutube
More information about gregory-gerard/rutube
Files in gregory-gerard/rutube
Package rutube
Short Description RutubeM3U8Scrapper helps you to retrieve a list of HLS streams for a Rutube LiST video.
License
Informations about the package rutube
RutubeM3U8Scrapper
RutubeM3U8Scrapper helps you to retrieve a list of HLS streams / M3U8 playlist of a Rutube LiST video, with those HLS streams you can download a video, streaming it in your favorite video player or whatever you want. You still need an account at Rutube LiST website, but you don't need anymore to watch an ad or answer to their quiz.
I've developed RutubeM3U8Scrapper for myself so it's maybe not very scalable and bug-proof, but I thought other people would need it!
Install
Clone the repository
git clone https://github.com/Gregory-Gerard/RutubeM3U8Scrapper.git
Install dependencies (Guzzle) with composer
composer install
You also need PHP >= 7.0 installed on your computer.
apt install php
Configuration
If you want to use RutubeM3U8Scrapper in your CLI, you need to configure it.
cp config.example.php config.php
(duplicate config.example.php to config.php and update your config)
Add your login (which is a mobile number with a + and your international dialling code in front of the mobile number) and password in $credentials
array, this is required because of the design of Rutube LiST (RutubeM3U8Scrapper can't call Rutube LiST api without logging-in).
How to use
CLI
Simply run rutube.php
with a video id, example:
php rutube.php 26f9dfab263c80f22c16b0ef1c4b77ad
php rutube.php 6105209
It should echo something like this
Programmatically
For documentation, check RutubeScrapper.php code, full example :
$instance->streamList()
return a multidimensional array on two levels, with the resolution and the different bandwidths for each resolution with its url :
If an internal error occurs, RutubeScrapper throw a RutubeScrapperException. Otherwise, if it's a request error (like a 404 or bad request) a GuzzleException is thrown.
Use cases
Now with the HLS streams in your possession, you can download a Rutube LiST video with youtube-dl, ffmpeg or streaming it in VLC.
How it works
I did some reverse engineering into Rutube LiST network trace, so the scrapper code simply makes the same calls that a user makes when watching a video, to describe more precisely (you can also read RutubeScrapper.php):
- First of all, the scrapper need to be logged ;
- The scrapper retrieve the internal video id, that is sometimes different from the id you have in your possession, sometimes not ;
- To retrieve Rutube video balancer, Rutube API ask for an « award token », this award token is given by Rutube ads or Rutube quiz ;
- So, the scrapper call Rutube ads API to retrieve directly your « award token » without watching anything ;
- Then it simply echo the video balancer of your video.
To-Do
- [x] Update RutubeM3U8Scrapper into a class