PHP code example of gregory-gerard / rutube

1. Go to this page and download the library: Download gregory-gerard/rutube library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

gregory-gerard / rutube example snippets


// example
$credentials = [
    'phone' => '+33611111111',
    'password' => 'some_strong_password'
];

$scrapper = new RutubeScrapper();
$scrapper->login('+33367358878', 'f*riaa');
$internalVideoId = $scrapper->video('26f9dfab263c80f22c16b0ef1c4b77ad');
$award = $scrapper->award($internalVideoId);

foreach($scrapper->streamList($internalVideoId, $award) as $resolution => $bandwidthList) {
    echo PHP_EOL."---------- {$resolution} ----------".PHP_EOL;

    foreach ($bandwidthList as $bandwidth => $url) {
        echo "{$bandwidth} Kbps : {$url}".PHP_EOL;
    }
}

$streamList = [
    '640x360' => [
        639000 => 'https://video-317-2.pladform.ru/dive/video-1-102.rutube.ru/uPbtg49VskvVH_yBfl7WKQ/hls-vod/Sr4PXLRXagAb0vBftkax1A/1604813503/582/0x5000cca255e4e76a/8aa68a1ad46f4a93813fc4262947e5c3.mp4.m3u8?i=640x360_639',
        1151000 => 'https://video-317-2.pladform.ru/dive/video-1-102.rutube.ru/L6Knb9JNjMYm7GRL4VK3LA/hls-vod/G-z2JhlM10AFGeePdlS6Zg/1604813503/128/0x5000cca255cc90a7/b9132563fe2f40c8b402b9da03c5b879.mp4.m3u8?i=640x360_1151',
    ],
    '1280x720' => [
        1589000 => 'https://video-317-2.pladform.ru/dive/video-1-102.rutube.ru/WQJWM8YqYYMqyUGDI4xnxQ/hls-vod/zPao-gq6pwNB8rmrtC1Fsw/1604813503/119/0x500003970ba81d10/3750791273114be1ae6d57a434f1c2a1.mp4.m3u8?i=1280x720_1589',
    ],
];