I'm not really sure how to ask this, but I have a php script that pulls data from the youtube-v3-api for my youtube channel, mainly a list of videos that I have published. It's been working great up until earlier today when I went to run it again because I added a new video. Here's the output for the first object in the items array
items:[ { kind:"youtube#searchResult", etag:"" XpPGQXPnxQJhLgs6enD_n8JR4Qk/tluoWYe5GE9lVFAkcMtcec2Ycug"", id:{ kind:"youtube#channel", channelId:"UCD8d3FGC907iS1qiMF0ccxA" }, snippet:{ publishedAt:"2006-04-30T19:39:08.000Z", channelId:"UCD8d3FGC907iS1qiMF0ccxA", title:"Travis Ballard", description:"", thumbnails:{ default:{ url:"https://yt3.ggpht.com/-L5MV7tUNjlk/AAAAAAAAAAI/AAAAAAAAAAA/dXNuqxAYprw/s88-c-k-no-mo-rj-c0xffffff/photo.jpg" }, medium:{ url:"https://yt3.ggpht.com/-L5MV7tUNjlk/AAAAAAAAAAI/AAAAAAAAAAA/dXNuqxAYprw/s240-c-k-no-mo-rj-c0xffffff/photo.jpg" }, high:{ url:"https://yt3.ggpht.com/-L5MV7tUNjlk/AAAAAAAAAAI/AAAAAAAAAAA/dXNuqxAYprw/s800-c-k-no-mo-rj-c0xffffff/photo.jpg" } }, channelTitle:"Travis Ballard", liveBroadcastContent:"none" } }]This does not represent a video on my channel? also, it's not in order at all. It should be ordered by date as i'm asking it to in my php script:
<?php const APIKEY = 'MyAPIKeyHere'; const CHANNELID = 'UCD8d3FGC907iS1qiMF0ccxA'; const VIDEO_COUNT = 50; class FetchYoutubeVideos { private $api_key = null; private $channel_id = null; private $count = null; public function __construct($api_key, $channel_id, $count = 10) { $this->api_key = $api_key; $this->channel_id = $channel_id; $this->count = $count; $this->writeToFile('videos.json', $this->fetch($this->getApiUrl()) ); printf( 'fetched videos from: %s', $this->getApiUrl()); } public function getApiUrl($options = array()) { $endpoint = 'https://www.googleapis.com/youtube/v3/search'; $default_options = array('key' => $this->api_key,'channelId' => $this->channel_id,'part' => 'snippet,id','order' => 'date','maxResults' => $this->count ); $options = array_merge($options, $default_options); return sprintf('%s/?%s', $endpoint, http_build_query($options)); } public function fetch($url) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch); return $result; } public function writeToFile($filename, $data) {; $fh = fopen($filename, 'w+'); fwrite($fh, $data, strlen($data)); fclose($fh); } } $fetchVideos = new FetchYoutubeVideos(APIKEY, CHANNELID, VIDEO_COUNT);The newest video should be 'Tragic - Rock-a-Hoola Revisited' and then 'Rocket Timelapse - Anycubic i3 Mega'. You can reference my yt channel to see what it should be returning: https://www.youtube.com/channel/UCD8d3FGC907iS1qiMF0ccxA?view_as=subscriber
Any insights into why it changed? Or why it's not returning the data that it should be?