Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $vimeoConfig = \Yii::$app->params['secrets']['vimeo'];
- $lib = new \Vimeo\Vimeo("", "", "");
- $next = "/me/videos?fields=name,uri,download&page=$page";
- $videos = $lib->request($next);
- if (isset($videos['body']['error'])) {
- die(print_r($videos));
- }
- echo $videos['headers']['X-RateLimit-Remaining'];
- if (intval($videos['headers']['X-RateLimit-Remaining']) < 5) {
- echo "\n\n\n\nRateLImit too low!!!!!!!!!\n\n\n";
- die();
- }
- foreach ($videos['body']['data'] as $videoData) {
- $finalLink = "";
- echo $videoData['name'] . "\n";
- $found = false;
- foreach ($titles as $title) {
- if (startsWith($title, $videoData['name'])) {
- $found = true;
- }
- }
- if (!$found) {
- echo "Not found - continue";
- continue;
- }
- $finalLink = "";
- foreach ($videoData['download'] as $link) {
- $finalLink = $link['link'];
- if ($link['quality'] == 'hd') {
- break;
- }
- }
- if (!$finalLink) {
- echo "Kein Link";
- print_r($videoData);
- }
- //set link as a card
- $data = [
- "during" => [
- [
- "card" => [
- "description" => "Hier klicken, um das Video zur privaten Nutzung herunterzuladen.",
- "link" => $finalLink,
- "name" => "Video runterladen",
- ],
- "time_code" => "1",
- "type" => "card",
- ]
- ],
- "before" => null,
- "after" => null,
- ];
- echo "$finalLink\n\n";
- $req = $lib->request("{$videoData['uri']}/timelineevents", $data, 'PATCH');
- echo json_encode($req);
- echo "\n\n\n";
- if (intval($req['headers']['X-RateLimit-Remaining']) < 10) {
- echo "\n\n\n\nRateLImit too low!!!!!!!!!\n\n\n";
- die();
- }
- sleep(2);
- }
Add Comment
Please, Sign In to add comment