Why is it when I search for a channel by ID https://www.googleapis.com/youtube/v3/channels?part=contentDetails&id=UU-tdS40X5ld-a4KfarLJuDw&key=[YOUR_API_KEY] I get no items returned.
But when I search by userName, it returns the channel ID that I just searched for https://www.googleapis.com/youtube/v3/channels?part=contentDetails&forUsername=washingtonstateuniv&key=[YOUR_API_KEY]
when I search for a channel by ID .. I get no items returned.
Give the Try-it section for channels.list a try. I'm able to fetch JSON response by using these parameters:
part->contentDetails
id-> yourchannel ID
Authorize and Execute
The response it returned is not empty at all.
{
"kind": "youtube#channelListResponse",
"etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/FiuYcDu7WFmoFVcLDRvENYGl_tQ\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"I_8xdZu766_FSaexEaDXTIfEWc0/QjMybH99xT3x-znrh2Yerx_0DWk\"",
"id": "{my channel id}",
"snippet": {
"title": "{my channel name}",
"description": "",
"publishedAt": "2011-10-10T15:30:40.000Z",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-EN5H1HDHqIU/ABCDEFGHIJK/ABCDEFGHIJK/l2gqeYg94P8/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-EN5H1HDHqIU/ABCDEFGHIJK/ABCDEFGHIJK/l2gqeYg94P8/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-EN5H1HDHqIU/ABCDEFGHIJK/ABCDEFGHIJK/l2gqeYg94P8/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
},
"localized": {
"title": "{my channel name}",
"description": ""
}
}
}
]
}
That's a lot of results for me.
But when I search by userName, it returns the channel ID that I just
searched for.
In the channels.list try-it docs above, forUsername is defined as the forUsername parameter specifies a YouTube username, thereby requesting the channel associated with that username. So I think it's doing it's job.
Additional note on forUsername parameter is that's it's used to translate your arbitrary legacy YouTube username, that's the old Youtube accounts, into a channel ID using v3 of the API. More of that in Work with Channel IDs guide.
when I search by userName, it returns the channel ID that I just
searched for
You miss the important part to search by forUsername or channelID. That is snippet part, not contentDetails.
by forUsername :
https://www.googleapis.com/youtube/v3/channels?&part=snippet,id&forUsername=RealMiBs&title&key={YOUR_API_KEY}
by id channel:
https://www.googleapis.com/youtube/v3/channels?&part=snippet,id&id=UC_pwIXKXNm5KGhdEVzmY60A&title&key={YOUR_API_KEY}
That will exactly returned to like below:
{
"kind": "youtube#channelListResponse",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/VnicD0AYsCI7KlKKcdsmdIlWUMs\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/Nl4tuuOFwuPOdHmP_Ky3vuIQ2Gg\"",
"id": "UC_pwIXKXNm5KGhdEVzmY60A",
"snippet": {
"title": "CJENMMUSIC Official", <== Channel Name
"description": "Asia's No.1 Entertainment & Media Company", <== Channel Desctiption
"customUrl": "cjenmmusic", <=== Channel URL who has been qualified - to and for - claimed it
"publishedAt": "2011-03-25T04:48:40.000Z",
"thumbnails": {
"default": {
"url": "https://yt3.ggpht.com/-QMkGdFbhrOc/AAAAAAAAAAI/AAAAAAAAAAA/6boUKax-3EA/s88-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"medium": {
"url": "https://yt3.ggpht.com/-QMkGdFbhrOc/AAAAAAAAAAI/AAAAAAAAAAA/6boUKax-3EA/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
},
"high": {
"url": "https://yt3.ggpht.com/-QMkGdFbhrOc/AAAAAAAAAAI/AAAAAAAAAAA/6boUKax-3EA/s240-c-k-no-mo-rj-c0xffffff/photo.jpg"
}
},
"localized": {
"title": "CJENMMUSIC Official",
"description": "Asia's No.1 Entertainment & Media Company"
}
}
}
]
}
While if you just pointing to contentDetails, it will return to almost nothing:
{
"kind": "youtube#channelListResponse",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/C7SnOhT2c-Fs2R9f6JlxlOPWc34\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"uQc-MPTsstrHkQcRXL3IWLmeNsM/3RTKaEQC9GX8c58R2Bhd8G1y3zM\"",
"id": "UC_pwIXKXNm5KGhdEVzmY60A",
"contentDetails": { <============== detail contents
"relatedPlaylists": {
"uploads": "UU_pwIXKXNm5KGhdEVzmY60A",
"watchHistory": "HL",
"watchLater": "WL"
}
}
}
]
}
Related
I have noticed that all videos from the account, Kanye West - Topic, don't show up in the api results. Does anyone have a reason why or a solution to fix this? For example, when I use the api search GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCRY5dYsbIN5TylSbd7gVnZg&type=video&key={YOUR_API_KEY}, it says there are 961 total results but the items section is empty.
Your GET request is correct but it's missing additional field resources parameters, so it doesn't know what you want to retrieve. I've added the fields to your GET REQUEST using the Google API Explorer and here's what it looks like:
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UCRY5dYsbIN5TylSbd7gVnZg&maxResults=50&q=%22Kanye+West%22&fields=etag%2CeventId%2Citems%2Ckind%2CnextPageToken%2CpageInfo%2CprevPageToken%2CregionCode%2CtokenPagination%2CvisitorId&key={API_KEY_HERE}
And the response was:
{
"kind": "youtube#searchListResponse",
"etag": "\"GM4ZnRh2gk1X1BLWgHklTm-3cgQ/6VdmXA4FhXjg08y58iRnmXZY7wQ\"",
"nextPageToken": "CDIQAA",
"regionCode": "PH",
"pageInfo": {
"totalResults": 841,
"resultsPerPage": 50
},
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"GM4ZnRh2gk1X1BLWgHklTm-3cgQ/VSzDMW_CqJw-OMjo_vzPR2P40eI\"",
"id": {
"kind": "youtube#channel",
"channelId": "UCRY5dYsbIN5TylSbd7gVnZg"
},
"snippet": {
"publishedAt": "2013-07-02T20:09:18.000Z",
"channelId": "UCRY5dYsbIN5TylSbd7gVnZg",
"title": "Kanye West - Topic",
"description": "Kanye Omari West is an American rapper, songwriter, record producer, fashion designer, and entrepreneur. Born in Atlanta and raised in Chicago, West first ...",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/1.jpg"
},
"medium": {
"url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/mq1.jpg"
},
"high": {
"url": "https://i.ytimg.com/i/RY5dYsbIN5TylSbd7gVnZg/hq1.jpg"
}
},
"channelTitle": "Kanye West - Topic",
"liveBroadcastContent": "none"
}
.. (long list below)
If you want to conduct additonal test, use the Youtube API Explorer.
Using the Youtube Data API's Channels:list with the brandingSettings part works when using the id filter but not the forUsername filter for me.
For example, GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&forUsername=h3h3Productions&key={YOUR_API_KEY} results in the following, which is missing brandSettings:
{
"kind": "youtube#channelListResponse",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/Qagk6ayL_umilQ398UZyAHwxK_g\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 5
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/tTzKQvYs0Y2GpqN2wqgudxB2TnQ\"",
"id": "UCDWIvJwLJsE4LG1Atne2blQ"
}
]
}
But GET https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&id=UCDWIvJwLJsE4LG1Atne2blQ&key={YOUR_API_KEY} (which you'll notice uses the ID of the same user), leaves it intact:
{
"kind": "youtube#channelListResponse",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/2ZOHdezDOZFRR9xisREY04R4OOg\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"kind": "youtube#channel",
"etag": "\"0KG1mRN7bm3nResDPKHQZpg5-do/58_5G5_Hi-64MiC8m5NC76sDIOA\"",
"id": "UCDWIvJwLJsE4LG1Atne2blQ",
"brandingSettings": {
"channel": {
"title": "h3h3Productions",
"description": "Wacky, zany, goofy comedy. ",
"keywords": "comedy humor satire parody funny sketch \"sketch comedy\" reaction \"reaction video\" review h3h3 h3h3productions",
"showRelatedChannels": true,
"showBrowseView": true,
"featuredChannelsTitle": "SECOND CHANNEL",
"featuredChannelsUrls": [
"UC7pp40MU_6rLK5pvJYG3d0Q"
],
"unsubscribedTrailer": "tVaAv0cPRok",
"profileColor": "#000000",
"country": "US"
},
"image": {
"bannerImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1060-fcrop64=1,00005a57ffffa5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerMobileImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w640-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTabletLowImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1138-fcrop64=1,00005a57ffffa5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTabletImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1707-fcrop64=1,00005a57ffffa5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTabletHdImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w2276-fcrop64=1,00005a57ffffa5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTabletExtraHdImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w2560-fcrop64=1,00005a57ffffa5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerMobileLowImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w320-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerMobileMediumHdImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w960-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerMobileHdImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1280-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerMobileExtraHdImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1440-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTvImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w2120-fcrop64=1,00000000ffffffff-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTvLowImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w854-fcrop64=1,00000000ffffffff-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTvMediumImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1280-fcrop64=1,00000000ffffffff-nd/youtube%2Bnew%2Bbanner14.jpg",
"bannerTvHighImageUrl": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w1920-fcrop64=1,00000000ffffffff-nd/youtube%2Bnew%2Bbanner14.jpg"
},
"hints": [
{
"property": "channel.banner.mobile.medium.image.url",
"value": "https://yt3.ggpht.com/-DFbgqVWqgm8/VDV_M-xkJtI/AAAAAAAAAOE/zQeoRrTR-qA/w640-fcrop64=1,32b75a57cd48a5a8-nd/youtube%2Bnew%2Bbanner14.jpg"
},
{
"property": "channel.banner.image_height.int",
"value": "0"
},
{
"property": "channel.featured_tab.template.string",
"value": "Everything"
},
{
"property": "channel.modules.show_comments.bool",
"value": "True"
}
]
}
}
]
}
Am I doing something wrong? Keeping everything the same but switching the part to snippet or statistics works how you'd expect in both cases. I've also tried this on a few more channels and get the same results.
I think this is working as intended. See YouTube API - No channel branding settings returned for queries by username. Tl;dr: even though you can look for channels by using their usernames, the migration from V2 carried with it the fact that not every YouTube channel has a unique username, so that's why it works correctly when you use the channel ID (which is unique). I also tried it by specifying forMine instead of the channel ID and it worked as expected.
I'm searching youtube videos with youtube api 3.0.
I'm using this type of example API request
https://www.googleapis.com/youtube/v3/search?part=snippet&key=[API_KEY]
But i want to get statistics of videos with in the same api request. How to solve this problem.
Note: When I'm using statistics key with part. I got error.
I'm also tried this request
https://www.googleapis.com/youtube/v3/search?part=snippet,statistics&key=[API_KEY]
The resource search.list don't have the part statistics.
Step 1 :
You need to get the videoId of the video: "videoId": "UHdgXkkVyl0" with search.list.
The request :
https://www.googleapis.com/youtube/v3/search?part=id&q=tuto&type=video&key={YOUR_API_KEY}
The response:
"items": [
{
"kind": "youtube#searchResult",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/34CzOO9FXYQg7kdlOeoe59LsWVk\"",
"id": {
"kind": "youtube#video",
"videoId": "UHdgXkkVyl0"
}
},
{
"kind": "youtube#searchResult",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/U303dB0TgZ89ODlqdwuKs5efOdk\"",
"id": {
"kind": "youtube#video",
"videoId": "LvEA2KHWQec"
}
},
Step 2 :
After you have searched videos with search.list you need to make a second call to the API with the resource video.list with parameters :
part: statistics
id: "id of the video found in previous request"
If you have more than one video id you can specify the id of videos with a comma-separated list like :
id: "Xxsdw6zG1bg, Xxsdw6zG1bg,...." )
The request: https://www.googleapis.com/youtube/v3/videos?part=statistics&id=UHdgXkkVyl0%2C+Xxsdw6zG1bg&key={YOUR_API_KEY}
The response will be like this :
{
"kind": "youtube#videoListResponse",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/rxvjZzq2nNqBg7Me5VQv1ToZm64\"",
"pageInfo": {
"totalResults": 2,
"resultsPerPage": 2
},
"items": [
{
"kind": "youtube#video",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/3fah-cngFxFOnytseMYZU1TK_-8\"",
"id": "UHdgXkkVyl0",
"statistics": {
"viewCount": "3070836",
"likeCount": "72140",
"dislikeCount": "1132",
"favoriteCount": "0",
"commentCount": "7798"
}
},
{
"kind": "youtube#video",
"etag": "\"MmqJLb8ZBOWRQIsg7xej7lrKLMI/J4xM7Dd23TGYU6on-PESyEIAE9A\"",
"id": "Xxsdw6zG1bg",
"statistics": {
"viewCount": "131487",
"likeCount": "1459",
"dislikeCount": "25",
"favoriteCount": "0",
"commentCount": "39"
}
}
]
}
And you have the statistics !
Unfortunately, dislikeCount attribute has became private, in december 2021. according the youtube api docs.
I want to list all the movies available on YouTube (i.e. those available via //youtube.com/movies). I can see how to query those using API V2, but this has a limit of 1000 responses.
With the V3 api I can see the category for movies has id 30, but I can't work out how to get all movies with this category. The only category queries appear to search on guide categories, which are different.
Any clues on how I can get this list? Please help if you can!
I believe that you can get the autogenerated channels, related to movies, and use their id to get the playlists related to this channels and finally the items (videos..) from this playlists, that must be the videos related to the movies of the selected channels:
Retrieve movie channels:
Request
https://www.googleapis.com/youtube/v3/search?part=snippet&q=movies&type=channel&key={YOUR_API_KEY}
Partial response
"items": [
{
"id": {
"kind": "youtube#channel",
"channelId": "UCczhp4wznQWonO7Pb8HQ2MQ"
},
"kind": "youtube#searchResult",
"etag": "\"eTr3dHIt5_K9qdGtRKL-5XdpiQI/sQpwXP-0MUEZzOQx4F0yKj0eUR4\"",
"snippet": {
"publishedAt": "2005-12-15T03:07:36.000Z",
"channelId": "UCczhp4wznQWonO7Pb8HQ2MQ",
"title": "movies",
"description": "YouTube Movies (United States).",
"thumbnails": {
"default": {
"url": "http://i.ytimg.com/i/czhp4wznQWonO7Pb8HQ2MQ/1.jpg"
},
"medium": {
"url": "http://i.ytimg.com/i/czhp4wznQWonO7Pb8HQ2MQ/mq1.jpg"
},
"high": {
"url": "http://i.ytimg.com/i/czhp4wznQWonO7Pb8HQ2MQ/hq1.jpg"
}
}
}
},
e.g. Get the list of movies in channel "YouTube Movies (United States)"
Request
https://www.googleapis.com/youtube/v3/playlists?part=snippet&channelId=UCczhp4wznQWonO7Pb8HQ2MQ&key={YOUR_API_KEY}
Partial response:
{
"id": "PLjygWhZE6KY0Uhw12FsAc8raAClz0l71C",
"kind": "youtube#playlist",
"etag": "\"eTr3dHIt5_K9qdGtRKL-5XdpiQI/TWrkoCkmJvq14neCcutnApHMMgU\"",
"snippet": {
"publishedAt": "2012-12-06T20:11:40.000Z",
"channelId": "UCczhp4wznQWonO7Pb8HQ2MQ",
"title": "The Nicolas Cage Collection",
"description": "From panicked fathers to spirits of vengeance, Nicolas Cage has done it all.",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/hqdefault.jpg"
}
}
}
},
Get items from this playlist:
Request:
https://www.googleapis.com/youtube/v3/playlistItems?part=snippet&playlistId=PLjygWhZE6KY0Uhw12FsAc8raAClz0l71C&key={YOUR_API_KEY}
Partial response:
{
"kind": "youtube#playlistItemListResponse",
"etag": "\"eTr3dHIt5_K9qdGtRKL-5XdpiQI/KSlqEnNGq36l47_k9W3fd79KfYQ\"",
"pageInfo": {
"totalResults": 15,
"resultsPerPage": 5
},
"nextPageToken": "CAUQAA",
"items": [
{
"id": "PLcBtbpFAOApiV34TU797yEFAUZuwhFrvJya3MqlZWkGM",
"kind": "youtube#playlistItem",
"etag": "\"eTr3dHIt5_K9qdGtRKL-5XdpiQI/C_xTa48Xof7giXobSula2vWX43A\"",
"snippet": {
"publishedAt": "2012-12-06T20:12:49.000Z",
"channelId": "UCczhp4wznQWonO7Pb8HQ2MQ",
"title": "Stolen",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/nHiy8SVZdpU/hqdefault.jpg"
}
},
"playlistId": "PLjygWhZE6KY0Uhw12FsAc8raAClz0l71C",
"position": 0,
"resourceId": {
"kind": "youtube#video",
"videoId": "nHiy8SVZdpU"
}
}
},
{
"id": "PLcBtbpFAOApiV34TU797yED-1zeMCoMGVxtVgtX9ZdsQ",
"kind": "youtube#playlistItem",
"etag": "\"eTr3dHIt5_K9qdGtRKL-5XdpiQI/LgSyqtZkwJXv6-2ajW0g-FsgddQ\"",
"snippet": {
"publishedAt": "2012-12-06T20:19:26.000Z",
"channelId": "UCczhp4wznQWonO7Pb8HQ2MQ",
"title": "Trespass",
"thumbnails": {
"default": {
"url": "https://i.ytimg.com/vi/J_7Zug6ouy4/default.jpg"
},
"medium": {
"url": "https://i.ytimg.com/vi/J_7Zug6ouy4/mqdefault.jpg"
},
"high": {
"url": "https://i.ytimg.com/vi/J_7Zug6ouy4/hqdefault.jpg"
}
},
"playlistId": "PLjygWhZE6KY0Uhw12FsAc8raAClz0l71C",
"position": 1,
"resourceId": {
"kind": "youtube#video",
"videoId": "J_7Zug6ouy4"
}
}
},
and in this way you can create the list of videos as you want
Here's my current answer - still working on it so I've not accepted it yet
I worked out the categoryId for Movies is 30. I then did a search for videos using this categoryId, and the query string "movie" (just because I need to put something). This gives more than 1000 results, and google limits queries to 1000 results even with the v3 api.
So I need to partition my query. I have been able to do this with publishedBefore and publishedAfter. Note these are upload dates and not release dates.
This gives me a list of movies.
Here's a sample query
https://www.googleapis.com/youtube/v3/search?nextPageToken=CDIQAA&publishedBefore=2010-02-01T00%3A00%3A00Z&maxResults=50&q=movie&videoCategoryId=30&part=id%2Csnippet&key=yourAPIKeyHere&type=video&publishedAfter=2010-01-01T00%3A00%3A00Z
Once I have the movie IDs I query the individual movie ids
https://www.googleapis.com/youtube/v3/videos?part=snippet%2CcontentDetails&maxResults=50&id=O7cSKNevYQc%2CN84-SoboM6c%2C9K_WO3lqDSc%2CWTJP0Z-bknc%2CdF9hwjeRbGE%2CPnefvJ9T1N0%2CDuM6B4yKgTU%2C0tI8iP2f58I%2Cr4lNJEnY0FA%2COFnMrx6yEcA%2CmUZUAeqOmbg%2CDjq0tHK-KTo%2CkY44nxk0qjg%2CcLYkUR5MY14%2CTZpcfYOOEXA%2C-0jA9DMX8Qs%2C2TQDV1m4X2s%2CBh3Tye1OQvk%2Ct5IwjMDVNz4%2CkOi88X6xeKg%2Ck53CuaAUtik%2CNaRuenqLb9g%2Cn9h-0Wgix7Q%2CQG8SiW2a_l0%2Cmk-D66Z1Ydg%2ClvmwofckpNc%2CgRQK4fTXfBM%2CPZHgLy48R3Q%2CwczeO0DVM0g%2CTpMDTG3dEYE%2C6JI8pN7BqEQ%2COv9yllk3hsY%2CsN09sfLPu0g%2CbfhLYJGN948%2CPiWusdK75Ys%2CeE5jh0YwTCY%2C_cIw3vr2Q18%2CSA4xg_k0aqI%2CUZdha0zTM6w%2CwUdkDSIBw94%2CAhR-LDSIOaI%2C1XMt40vJayU%2C83fPx5-aUL8%2CmJLjaKzu7PQ%2CZvj_zRGnwU0%2CtyIPMd7JXOA%2CToE10sC36KQ%2COVKXjOW6cD8%2CLPW1cXVjMrg&key=LALALA
I still then need to filter the results by looking at the following json in the results
"contentDetails": {
"duration": "PT1H35M14S",
"regionRestriction": {
"allowed": [
"US"
]
}
Unfortunately this still doesn't give me the movie year or director (which are useful for working out which movie this actually is), or the price (which, you know, people find interesting)
How do I list the user's uploaded videos in the V3 api?
If you are using the client then Greg's answer is correct. To do the same thing with basic requests you make the following 2 requests:
GET https://www.googleapis.com/youtube/v3/channels
with parameters:
part=contentDetails
mine=true
key={YOUR_API_KEY}
and header:
Authorization: Bearer {Your access token}
From this you will get a JSON response like so:
{
"kind": "youtube#channelListResponse",
"etag": "\"some-string\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 1
},
"items": [
{
"id": "some-id",
"kind": "youtube#channel",
"etag": "\"another-string\"",
"contentDetails": {
"relatedPlaylists": {
"likes": "channel-id-for-your-likes",
"favorites": "channel-id-for-your-favorites",
"uploads": "channel-id-for-your-uploads",
"watchHistory": "channel-id-for-your-watch-history",
"watchLater": "channel-id-for-your-watch-later"
}
}
}
]
}
From this you want to parse out the "uploads" channel-id.
GET https://www.googleapis.com/youtube/v3/playlistItems
with parameters:
part=snippet
maxResults=50
id={YOUR_UPLOAD_PLAYLIST_ID}
key={YOUR_API_KEY}
and headers:
Authorization: Bearer {YOUR_TOKEN}
From this you will receive a JSON response like the following:
{
"kind": "youtube#playlistItemListResponse",
"etag": "\"some-string\"",
"pageInfo": {
"totalResults": 1,
"resultsPerPage": 50
},
"items": [
{
"id": "some-id",
"kind": "youtube#playlistItem",
"etag": "\"another-string\"",
"snippet": {
"publishedAt": "some-date",
"channelId": "the-channel-id",
"title": "video-title",
"thumbnails": {
"default": {
"url": "thumbnail-address"
},
"medium": {
"url": "thumbnail-address"
},
"high": {
"url": "thumbnail-address"
}
},
"playlistId": "upload-playlist-id",
"position": 0,
"resourceId": {
"kind": "youtube#video",
"videoId": "the-videos-id"
}
}
}
]
}
With this method you should be able to get the info using any language or even just curl. If you want more than the first 50 results, then you will have to do multiple queries using the second request and pass in page requests. More on this can be read at: http://developers.google.com/youtube/v3/docs/playlistItems/list
The first step is getting the channel id for that user. We can do this with request to the Channels service. Here's a JS example.
var request = gapi.client.youtube.channels.list({
// mine: true indicates that we want to retrieve the channel for the authenticated user.
mine: true,
part: 'contentDetails'
});
request.execute(function(response) {
playlistId = response.result.channels[0].contentDetails.uploads;
});
Once we get the playlist id we can use that to query for the list of uploaded videos from the PlaylistItems service.
var request = gapi.client.youtube.playlistItems.list({
id: playlistId,
part: 'snippet',
});
request.execute(function(response) {
// Go through response.result.playlistItems to view list of uploaded videos.
});