CommentThreads.list 403 - youtube-api

I'm getting:
{
"error": {
"code": 403,
"message": "The video identified by the \u003ccode\u003e\u003ca href="/youtube/v3/docs/commentThreads/list#videoId"\u003evideoId\u003c/a\u003e\u003c/code\u003e parameter has disabled comments.",
"errors": [
{
"message": "The video identified by the \u003ccode\u003e\u003ca href="/youtube/v3/docs/commentThreads/list#videoId"\u003evideoId\u003c/a\u003e\u003c/code\u003e parameter has disabled comments.",
"domain": "youtube.commentThread",
"reason": "commentsDisabled",
"location": "videoId",
"locationType": "parameter"
}
]
}
}
for
GET https://youtube.googleapis.com/youtube/v3/commentThreads?part=snippet,replies&allThreadsRelatedToChannelId=UC14YzmOgfiBEvEEeCDAtfjg
I could not identify any video on that channel with comment-disabled.
Moreover, I do try similar api call on channels that I know that have some videos with comment-disabled - and this API works perfectly (UCb0igM0fY85iaKarWkcLOAQ) with no errors.
Please advise - what's the logic regarding this error..
Thanks

Related

I am unable to create new asset, getting error 403

I am trying to enable monetization of a video but I'm getting error 403 and no more additional info
$asset = new \Google_Service_YouTubePartner_Asset();
$metadata = new \Google_Service_YouTubePartner_Metadata();
//if (array_key_exists('title', $data)) $metadata->setTitle($data['title']);
//if (array_key_exists('description', $data)) $metadata->setDescription($data['description']);
$metadata->setTitle('test title');
$metadata->setDescription('test desc');
$asset->setMetadata($metadata);
$asset->setType("web");
// Insert the asset resource. Extract its unique asset ID from the API
// response.
$assetInsertResponse = $this->youtube_partner->assets->insert($asset, ['onBehalfOfContentOwner' => $contentOwnerId]);
and the response is always
{
"error": {
"code": 403,
"message": "Forbidden",
"errors": [
{
"message": "Forbidden",
"domain": "global",
"reason": "forbidden"
}
]
}
}
Everything else seems to be working, i.e I can create policies with
$policy = new \Google_Service_YouTubePartner_Policy();
$policyRule = new \Google_Service_YouTubePartner_PolicyRule();
$policyRule->setAction("monetize");
$policy->setRules(array($policyRule));
$policy->setName('test');
$response = $this->youtube_partner->policies->insert($policy);

Unknown name \"model\" at 'config': Cannot find field

I'm trying to use Google Cloud speech (v1beta1) to analyse phone calls. I can't find the "model" parameter in the C# client library, so I'm constructing my own json message and sending it. This works:
{
"audio": {
"content": "UklGRiavCAA+P8QAAgA....."
},
"config": {
"languageCode": "nl-NL"
}
}
But when I add the phone_call model like this:
{
"audio": {
"content": "UklGRiavCAA+P8QAAgA....."
},
"config": {
"languageCode": "nl-NL",
"model": "phone_call"
}
}
I get an error:
{
"error": {
"code": 400,
"message": "Invalid JSON payload received. Unknown name \"model\" at 'config': Cannot find field.",
"errors": [
{
"message": "Invalid JSON payload received. Unknown name \"model\" at 'config': Cannot find field.",
"domain": "global",
"reason": "badRequest"
}
],
"status": "INVALID_ARGUMENT"
}
}
Why? Accoding to the documentation I believe my request is valid?
Edit: to answer my own question: turns out I was using a wrong url. The correct url is: https://speech.googleapis.com/v1p1beta1/speech:recognize.
I'm sorry to be the bearer of bad news, but it looks like the phone call model is only supported for en-US, and your language is nl-NL:
https://cloud.google.com/speech-to-text/docs/basics
Scroll down to "Selecting Models". "Command and Search" and "Default" are both listed as available for all languages, but "video" and "phone call" are listed as "en-US only".

Is that possible to change streamName after livestream create?

I tried to use livestream.update reset streamName, but it return a error
{ "error": { "errors": [ {
"domain": "youtube.liveStream",
"reason": "liveStreamModificationNotAllowed",
"message": "Modification is not allowed in current state" } ], "code": 403, "message": "Modification is not allowed in current state" } }
Is that possible to update or reset streamName after livestream created?
It's not possible to update the streamName after the object is created. You can create a new liveStream object with the same settings and a new name.

Youtube API: Comment Insert 403 forbidden insufficient permissions

I'm using the API explorer at the bottom of https://developers.google.com/youtube/v3/docs/commentThreads/insert to test this call. I am requesting the scope https://www.googleapis.com/auth/youtube.force-ssl. Appreciate any help!
REQUEST:
POST https://www.googleapis.com/youtube/v3/commentThreads?part=id%2Csnippet&fields=id&key={YOUR_API_KEY}
{
"snippet": {
"topLevelComment": {
"snippet": {
"textOriginal": "comment from gdev"
}
},
"videoId": "B5BypNLbBgQ",
"channelId": "UCNqqFgLtbSjc9Er7XFv4wbA"
}
}
RESPONSE:
{
"error": {
"errors": [
{
"domain": "youtube.commentThread",
"reason": "forbidden",
"message": "The comment thread could not be created due to insufficient permissions. The request might not be properly authorized.",
"locationType": "other",
"location": "body"
}
],
"code": 403,
"message": "The comment thread could not be created due to insufficient permissions. The request might not be properly authorized."
}
}
The video was private.... Worked fine on a public video.
I had a similar problem. I needed to set the token in the header. the request body needs to have:
part: "snippet"
I think you also would need to set a header of:
Authorization: 'Bearer ' + access_token
I uploaded a video and by default the comments were disabled. Once I changed to "Allow all comments" I could post via the API.

branding settings error youtube api

I have to update the featured video of my channel using youtube api.
When I sent PUT request using api explorer of the form
PUT https://www.googleapis.com/youtube/v3/channels?part=brandingSettings&key={YOUR_API_KEY}
{
"brandingSettings": {
"channel": {
"featuredChannelsTitle": "featured channel",
"featuredChannelsUrls": [
"http://www.youtube.com/user/channelname"
]
}
},
"id": "channelId"
}
I am getting response as follows
404 Not Found
- Show headers -
{
"error": {
"errors": [
{
"domain": "youtube.channel",
"reason": "channelNotFound",
"message": "Channel branding options not found.",
"locationType": "parameter",
"location": "id"
}
],
"code": 404,
"message": "Channel branding options not found."
}
}
Please let me know where I am going wrong.
I was giving the wrong channel ID. But now I am trying with the correct Channel Id, and I am getting yet another error message.
Content-Type: application/json
Authorization: Bearer ya29.1.AADtN_X2UP_3BfFvUwAkvLp0d0mk1U-itJNVtWMPEJQU8G7INQ5q-UpI1yNMYniiLQ
X-JavaScript-User-Agent: Google APIs Explorer
{
"id": channelId,
"brandingSettings": {
"channel": {
"featuredChannelsUrls": [
" http://www.youtube.com/user/USERNAME"
],
"featuredChannelsTitle": "Featured Channels"
}
}
}
Response is 400 Bad Request
- Show headers -
{
"error": {
"errors": [
{
"domain": "youtube.channel",
"reason": "brandingValidationError",
"message": "Channel branding validation failed.",
"locationType": "parameter",
"location": "brandingSettings"
}
],
"code": 400,
"message": "Channel branding validation failed."
}
}
If you can provide me a sample request it would be really helpful
As it says in the error message, it couldn't find the channel, make sure you are giving the right channel id.
The way to do it in API, do a channels->list request and use that response object, modify it and put it back. (Most important make sure the id is there and set.)

Resources