In order to learn this api I am trying to create a bot.
one of the things this bot does is to first comment when a channel uploads a video.
On some channels it works however on some channels it doesn't work.
For example on this channel https://www.youtube.com/channel/UC295-Dw_tDNtZXFeAPAW6Aw it claims the latest video is https://www.youtube.com/watch?v=cZI3Krk59T4 when the real latest video is https://www.youtube.com/watch?v=pceedMMwwcE&t.
self.youtube = build('youtube', 'v3', developerKey=api, credentials=credentials)
self.upload_id = self.youtube.channels().list(id=self.channel_id, part='contentDetails').execute()['items'][0]['contentDetails']['relatedPlaylists']['uploads']def get_latest_video(self):url = f'https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=1&playlistId={self.upload_id}&key={self.api}'json_url = urllib.request.urlopen(url)data = json.loads(json_url.read())self.quata_spent += 3return data['items'][0]['snippet']['resourceId']['videoId']
which is the same as calling this https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&maxResults=1&playlistId={self.upload_id}&key={self.api} Has anyone else has encountered this inconsistency ?
edit:
I found out that using the search method instead of the playlistItems works fine. Does anyone know why ? I cant afford using the search method as it costs 100 quatas per request.