Searching for HD videos using the YouTube API v3? - youtube

I am getting invalid combination of search filter error while retrieving the HD videos. this was the url - https://www.googleapis.com/youtube/v3/search?part=snippet&q=drama&videoDefinition=high&key={Developerkey}
Error report
{
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "Invalid combination of search filters and/or restrictions.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Invalid combination of search filters and/or restrictions."
}
}
Is it possible to retrieve HD videos? Please guide me. How can I get a response from this URL? Thanks

You also need to include the type=video query parameter, since filtering on high definition only makes sense when the results are limited to videos.
That being said, the error message that's returned isn't actually helpful, and I'll ask the engineering team to revise it so that it clarifies what's wrong.

Related

YouTube API 429 error while not using full quota

Still a couple of weeks; we are getting more and more 429 HTTP Errors while making API requests to the YouTube API (mainly when trying to add or delete videos in a playlist). The error seems related to "quotas" indicated in the Google API console, but we checked this and are way below the limit according to the Google console report (we already have increased our quota value in the past, so this one should be more than enough).
Any idea why we are getting this error?
Error message:
{
"error": {
"code": 429,
"message": "Resource has been exhausted (e.g. check quota).",
"errors": [
{
"message": "Resource has been exhausted (e.g. check quota).",
"domain": "global",
"reason": "rateLimitExceeded"
}
],
"status": "RESOURCE_EXHAUSTED"
}
}
And our quota for the YouTube API:

Google Youtube API nextPageToken

I have read a lot of the other post about using the nextPageToken with the Youtube API.
The reference I am using is
https://developers.google.com/apis-explorer/?hl=en_US#p/youtube/v3/youtube.commentThreads.list?part=snippet&maxResults=100&order=time&videoId=xyvQaVUeu90&fields=items(id%252Csnippet%252FtopLevelComment%252Fsnippet%252FtextDisplay)%252CnextPageToken&_h=35&
The video id i am using is xyvQaVUeu90
The script I run returns a nextPageToken as
QURTSl9pMm1EbHlJZFdJTENzcHpIMGI3VWllOVl0enBxREN3NlZSYzAzZVdQTkNKNV9XQkpmQTNYLWhhVDIzeGN5eUdXUDZqWUJkdFdBOGdKVksyOENUU3B4b014Yi12Y05PdGRRcVlTaHp3VXEyR0JxRFVYMm5rWG1sbUZsRmk
So according to the API, if I use that nextPageToken it should return the next page of comments, however when I place the nextPageToken as the pageToken
Reference:
https://developers.google.com/apis-explorer/?hl=en_US#p/youtube/v3/youtube.commentThreads.list?part=snippet&maxResults=100&order=time&pageToken=QURTSl9pMm1EbHlJZFdJTENzcHpIMGI3VWllOVl0enBxREN3NlZSYzAzZVdQTkNKNV9XQkpmQTNYLWhhVDIzeGN5eUdXUDZqWUJkdFdBOGdKVksyOENUU3B4b014Yi12Y05PdGRRcVlTaHp3VXEyR0JxRFVYMm5rWG1sbUZsRmk&videoId=xyvQaVUeu90&fields=items(id%252Csnippet%252FtopLevelComment%252Fsnippet%252FtextDisplay)%252CnextPageToken&_h=36&
It returns:
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "invalidPageToken",
"message": "The request specifies an invalid page token.",
"locationType": "parameter",
"location": "pageToken"
}
],
"code": 400,
"message": "The request specifies an invalid page token."
}
}
Any help would be nice!
It's working perfectly. Just make sure to copy everything between the double quotes ("") . I was able to use it without problems. For example the nextPageToken provided in your link is
"QURTSl9pMFZuQUJYNGc4dDVZRjRjYlJ3d0M1MlIzeTRSeEJfclZOeEEzdncxRVM4bGZFOXdIRVVVRkJibjBSVW5xaEtBTE1zS0VTd2lDNndrRmJQaG4tY1dScXFral9hMVQ3NmJidFI1Vk83a0xhWEJNU2cwMlYweERGLU1uMDhLazg="
but you only copied
QURTSl9pMFZuQUJYNGc4dDVZRjRjYlJ3d0M1MlIzeTRSeEJfclZOeEEzdncxRVM4bGZFOXdIRVVVRkJibjBSVW5xaEtBTE1zS0VTd2lDNndrRmJQaG4tY1dScXFral9hMVQ3NmJidFI1Vk83a0xhWEJNU2cwMlYweERGLU1uMDhLazg
You did not include =

Youtube API: Get videos from autogenerated channels (like Music)

Is there any way to get the videos from autogenerated channels (like this one https://www.youtube.com/channel/UC-9-kyTW8ZkZNDHQJ6FgpwQ/videos) directly, without having to access all the playlists?
Using https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC-9-kyTW8ZkZNDHQJ6FgpwQ&key=... gives me 0 items.
Gives me 0 Items
If you mean running the following exactly
https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC-9-kyTW8ZkZNDHQJ6FgpwQ&key=
Returns the following error
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "keyInvalid",
"message": "Bad Request"
}
],
"code": 400,
"message": "Bad Request"
}
}
That is because you have neglected to add an API key on the end.
Try testing in the query explorer this seams to return quite a few no idea if its all of them.
GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC-9-kyTW8ZkZNDHQJ6FgpwQ&maxResults=25&key={YOUR_API_KEY}
returns
"pageInfo": {
"totalResults": 786,
"resultsPerPage": 25
},
This apears to return a list of the playlists only for this user.
Update:
If you try and only request videos for this user you get 0 returned. This is not the case for any other user which i have tested.
GET https://www.googleapis.com/youtube/v3/search?part=snippet&channelId=UC-9-kyTW8ZkZNDHQJ6FgpwQ&maxResults=50&order=date&type=video&key={YOUR_API_KEY}
This leads me to believe that it is not possible to retrieve the videos for an autogenerated channel. I recommend either logging this as a bug or adding it as a feature request here. Personally i think its more a feature request.

What is the proper way to list all youtube broadcasts on behalf of the Content Owner (Youtube Partner) using Youtube API V3?

I tried this:
Went here - https://developers.google.com/youtube/v3/docs/search/list
Set the following parameters:
part - snippet
eventType - live (Also tried, completed)
forContentOwner - true
onBehalfOfContentOwner - 'Partner ID'
type - video
I have properly authenticated using the partners login credentials by switching on the OAuth at the top right of the form.
The documentation says, if 'eventType' is set, then the 'type' should be set to 'video' and if 'forContentOwner' is set then onBehlafOfContentOwner should be supplied and should be properly authenticated all of which I clearly did but I get the following error:
400 Bad Request
- Show headers -
{
"error": {
"errors": [
{
"domain": "youtube.search",
"reason": "invalidSearchFilter",
"message": "Invalid combination of search filters and/or restrictions.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "Invalid combination of search filters and/or restrictions."
}
}
As it says in the debug info: video_filter is unsupported in combination with for_content_owner filter.
So you can not do it this way.

trying to show more than 50 results corresponding to single topic id using freebase in android

I want to get more than 50 youtube video results corresponding to topic id ........so i am trying to get next page token.......
in youtube api v3 in android
and url used is....
https://www.googleapis.com/youtube/v3/videos?part=id,snippet&order=relevancee&topicId="+topicId+"&q="+videoId+"&key="
but the error giving is......
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "missingRequiredParameter",
"message": "No filter selected.",
"locationType": "parameter",
"location": ""
}
],
"code": 400,
"message": "No filter selected."
}
}
You should set type = video
Whenever you are using a video specific filter you have to filter type as well. As search is unified, otherwise it normally returns playlist, channel and videos as a result.
You can always try your queries in API explorer before implementing.

Resources