I have a code that takes the last videos of a channel and puts the thumbnails of them to run in a popup (with jquery, that part works well).
The code is this:
<?php
error_reporting(E_ALL);
$feedURL = 'http://gdata.youtube.com/feeds/api/users/{- USER ID -}/uploads?max-results=50';
$sxml = simplexml_load_file($feedURL);
$i = 0;
foreach ($sxml->entry as $entry):
$media = $entry->children('media', true);
$watch = (string)$media->group->player->attributes()->url;
$thumbnail = (string)$media->group->thumbnail[0]->attributes()->url;
$right_thumbnail = substr_replace($thumbnail, 'mqdefault', -5, -4);
?>
<li class="thumb-video">
<a data-link="<?php echo $watch; ?>" id="play-zg-<?= $i; ?>" class="watch-the-video transition-3s">
<img class="play-button transition-2s" src="<?= $directory_img; ?>/play-yt-icon.png">
<img src="<?php echo $right_thumbnail;?>" alt="<?php echo $media->group->title; ?>" />
</a>
</li>
<?php $i++; if($i == 2) { break; }; endforeach; ?>
This code worked fine until the google API changed from version 2 to version 3.
The problem is that now I can not adapt the requirements of the new API version to the code, since I do not understand anything about it = /
Could anyone help me?
From now on, I appreciate =)
Script no header:
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>