Order Doesn't Work When Using Youtube Api V3
I am trying to get the last 10 videos of a channel. When I run the following code: from apiclient.discovery import build API_SERVICE_NAME = 'youtube' API_VERSION = 'v3' def youtub
Solution 1:
Follow-up on issue #128673552, https://issuetracker.google.com/issues/128673552.
Solution 2:
You can use a workaround. Instead using the search.list
request, retrieve the uploaded videos.
By using the channel_id
change the letter as is explained here:
channel_id
: UCq-Fj5jknLsUf-MWSy4_brA
upload_playlist_id
: UUq-Fj5jknLsUf-MWSy4_brA
Use the PlaylistItems.list
request for retrieve the uploaded videos from a given channel.
This is the URL request:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet%2CcontentDetails&playlistId=<UPLOAD_PLAYLIST_ID>&fields=items(contentDetails(videoId%2CvideoPublishedAt)%2Csnippet(position%2Ctitle)%2Cstatus)&key={YOUR_API_KEY}
And those are the results:
{"items":[{"snippet":{"title":"Notebook | Main Taare | Teaser | Salman Khan | Pranutan Bahl | Zaheer Iqbal | Vishal Mishra","position":0},"contentDetails":{"videoId":"_wXRw1BMifw","videoPublishedAt":"2019-03-16T04:51:10.000Z"}},{"snippet":{"title":"Finito Full Song | AMAVAS | Sachiin J Joshi, Vivan, Navneet | Jubin Nautiyal, Sukriti Kakar, Ikka","position":1},"contentDetails":{"videoId":"dSzjNuV4R3g","videoPublishedAt":"2019-03-15T19:30:00.000Z"}},{"snippet":{"title":"T-SERIES MIXTAPE SEASON 2 Trailer l Bhushan Kumar | Abhijit Vaghani | Ahmed Khan","position":2},"contentDetails":{"videoId":"5itcXsszOiA","videoPublishedAt":"2019-03-15T09:27:59.000Z"}},{"snippet":{"title":"Bheege Bheege Full Video | AMAVAS | Sachiin J Joshi & Nargis Fakhri | Ankit Tiwari","position":3},"contentDetails":{"videoId":"3pY845c95AE","videoPublishedAt":"2019-03-16T11:00:01.000Z"}},{"snippet":{"title":"Jab Se Mera Dil Full Video | AMAVAS |Sachiin J Joshi & Nargis Fakhri |Armaan Malik,Palak Muchhal","position":4},"contentDetails":{"videoId":"XNPbW9BmBSo","videoPublishedAt":"2019-03-15T14:00:05.000Z"}}]}
This is the Google API Explorer demo you can use for guide yourself.
Post a Comment for "Order Doesn't Work When Using Youtube Api V3"