Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to change thumbnail #2552

Closed
icarojobs opened this issue Jan 14, 2024 · 2 comments
Closed

Error when trying to change thumbnail #2552

icarojobs opened this issue Jan 14, 2024 · 2 comments
Assignees
Labels
api: youtube priority: p2 Moderately-important priority. Fix may not be included in next release.

Comments

@icarojobs
Copy link

Thanks for stopping by to let us know something could be better!

PLEASE READ: If you have a support contract with Google, please create an issue in the support console instead of filing on GitHub. This will ensure a timely response.

Please run down the following list and make sure you've tried the usual "quick fixes":

If you are still having issues, please be sure to include as much information as possible:

Environment details

  • OS: MacOS M2
  • PHP version: 8.3
  • Package name and version: "google/apiclient": "^2.15.0"

Steps to reproduce

  1. After following the authentication flow and get/set the bearer token, I'm trying to change a thumbnail of specific video. I'm using Laravel too.

Code example

// After flow of authentication....this is my code:
$service = new Google_Service_YouTube($this->client);

$videoId = "XG96bA9Q9OE";
$newThumbnailPath = storage_path('app/thumbs/1/test1.jpg');

$response = $service->thumbnails->set($videoId, [
    'mimeType' =>  'image/jpeg',
    'data' =>  file_get_contents($newThumbnailPath)
]);

dd($response);

Response error:

{
  "error": {
    "code": 403,
    "message": "The thumbnail can't be set for the specified video. The request might not be properly authorized.",
    "errors": [
      {
        "message": "The thumbnail can't be set for the specified video. The request might not be properly authorized.",
        "domain": "youtube.thumbnail",
        "reason": "forbidden",
        "location": "videoId",
        "locationType": "parameter"
      }
    ]
  }
}

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

@yash30201
Copy link
Contributor

Hi @icarojobs , thanks for raising the issue.

Please make sure your account is verified. For more info, see:

  1. https://support.google.com/youtube/answer/72431
  2. https://stackoverflow.com/questions/38636310/set-custom-thumbnail-via-youtubeapi-doesnt-work-can-someone-tell-me-why

@yash30201 yash30201 self-assigned this Jan 16, 2024
@yash30201 yash30201 added api: youtube priority: p2 Moderately-important priority. Fix may not be included in next release. labels Jan 16, 2024
@icarojobs
Copy link
Author

Hi @icarojobs , thanks for raising the issue.

Please make sure your account is verified. For more info, see:

  1. https://support.google.com/youtube/answer/72431
  2. https://stackoverflow.com/questions/38636310/set-custom-thumbnail-via-youtubeapi-doesnt-work-can-someone-tell-me-why

Wow! This worked! Thank you! 🔥🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: youtube priority: p2 Moderately-important priority. Fix may not be included in next release.
Projects
None yet
Development

No branches or pull requests

2 participants