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

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.

Related

I can't get this Google Sheets API Get request to work

I am trying to have a game to request data from the Google Sheets API, and I can't get the API Key to function properly. I can visit my API Link in the browser, and it tells me it is getting HTTP 400 (Bad Request) and Google additionally says it's a bad API Key, despite having JUST generated it. For reference my link looks like this: "https://sheets.googleapis.com/v4/spreadsheets/[SHEET_ID]?key=[API_KEY]/values", and the browser views this when using it:
"error": {
"code": 400,
"message": "API key not valid. Please pass a valid API key.",
"status": "INVALID_ARGUMENT",
"details": [
{
"#type": "type.googleapis.com/google.rpc.ErrorInfo",
"reason": "API_KEY_INVALID",
"domain": "googleapis.com",
"metadata": {
"service": "sheets.googleapis.com"
}
}
]
}
}
I have absolutely no idea what is going wrong, I know the API key and Sheet ID are right (Directly copied each from their respective source).

Cannot delete comment on Youtube video via API

I'm trying to delete followiing comment z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo on this video but the response code is 400. I'm using token of the channel's admin with https://www.googleapis.com/auth/youtube.force-ssl scope as it required by documentation.
The request is:
DELETE https://www.googleapis.com/youtube/v3/comments?id=z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo&alt=json
{
"query_params": {
"id": "z12mdhjgxrfgtpf3d231jrz5vo3jdj0lo",
"alt": "json"
}
}
The response:
{
"error": {
"errors": [
{
"domain": "youtube.comment",
"reason": "processingFailure",
"message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid.",
"locationType": "parameter",
"location": "id"
}
],
"code": 400,
"message": "The API server failed to successfully process the request. While this can be a transient error, it usually indicates that the requests input is invalid."
}
}
What is wrong with the request?
That's token debug info:
{
issued_to: "493985796851.apps.googleusercontent.com",
audience: "493985796851.apps.googleusercontent.com",
user_id: "109704411339866376304",
scope: "https://www.googleapis.com/auth/plus.me https://www.googleapis.com/auth/youtube.force-ssl https://www.googleapis.com/auth/youtube.upload",
expires_in: 2452,
access_type: "offline"
}
The reason you're not able to delete the comment is that you're using Comments.delete to remove comment which was written by other users . Comments.delete only deletes your own comments in your video.
To delete comment of other users, use Comments.setModerationStatus and set moderationStatus to "rejected".
So just repeat what you did but this time using Comments.setModerationStatus. There's a Try-it in the link for testing purposes.

Why Youtube "channels" API don't return "contentOwnerDetails" data?

I'm trying to make this call to Youtube channels API but the response is without contentOwnerDetails. What is the problem?
GET https://www.googleapis.com/youtube/v3/channels?part=id%2CcontentDetails%2CcontentOwnerDetails&mine=true&key={YOUR_API_KEY}
It looks like it needs onBehalfOfContentOwner parameter. My request was
GET https://www.googleapis.com/youtube/v3/channels?part=snippet%2CcontentOwnerDetails&id=CHANNEL_ID&onBehalfOfContentOwner=NETWORK_ID
And I was able to get
"contentOwnerDetails": {
"contentOwner": NETWORK_ID,
"timeLinked": "2015-07-23T15:21:25.000Z"
}
For your GET method URI
https://www.googleapis.com/youtube/v3/channels?part=id%2CcontentDetails%2CcontentOwnerDetails&mine=true&key={YOUR_API_KEY}
The JSON response is as follows
{
"error": {
"errors": [
{
"domain": "youtube.parameter",
"reason": "authorizationRequired",
"message": "The request uses the <code>mine</code> parameter but is not properly authorized.",
"locationType": "parameter",
"location": "mine"
}
],
"code": 401,
"message": "The request uses the <code>mine</code> parameter but is not properly authorized."
}
}
According to YouTube Data API - Errors
401 (unauthorized) - authorizationRequired - The request uses the mine
parameter but is not properly authorized.
mine parameter value has to be set to true to instruct the API to only return channels owned by the authenticated user. (boolean)
Inference: You don't have the authorization to the content from the content owner, i.e., the YouTube Channel owner has probably denied permission to your application from accessing the channels content.
It's a permission issue. Where is the channelId in the URI? should probably add it.
If you don't own the channel the API will not return contentOwnerDetails. Since you're using mine=true parameter, you need to be properly authorized via OAuth first before the API will return contentOwnerDetails. See https://developers.google.com/youtube/v3/guides/authentication

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.

Searching for HD videos using the YouTube API v3?

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.

Resources