question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

youtube.thumbnails.set isn't working

See original GitHub issue

Hey. Trying to use youtube.thumbnails.set with videoId and media object properly set is giving me errors.

let req = Youtube.thumbnails.set(
  {
    videoId: video_id,
    media: {
      mimeType: "image/jpeg",
      body: "test.jpg"
    }
  },
  (err, thumbResponse) => {
    if (err) {
      console.log(err);
      process.exit(1);
    }
    console.log("thumbnail uploaded");
    console.log(thumbResponse);
  }
);

This results in Error: The provided image content is invalid.

Using a stream instead results in Error: write after end

The image I’m using is a typical 1280x720 image that I’ve tested by manually uploading to youtube fine. video_id is set to a video i own

At https://stackoverflow.com/questions/45535611/youtube-api-thumbnail-upload-isnt-working it was recommended I post here. full code sample at gist.github.com/2c2c/0736e87b6853b42828ad8480382ab427

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:4
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
2c2ccommented, Nov 13, 2017

original attempt was with a stream. didn’t help. lmk if it worked for you personally

1reaction
bantinicommented, Nov 13, 2017

@2c2c @sebseb7 @cot97 Try using a synchronous stream.

var upload_thumbnail = function(auth){
   var youtube = google.youtube('v3');
   youtube.thumbnails.set(
   {
     auth: auth,
     videoId: 'U49C3_DEWFM',
     media: {
       mimeType: 'image/jpeg',
       body: fs.readFileSync('youtube.jpg')
     },
   },
   (err, thumbResponse) => {
     if (err) {
       console.log("Error response");
       console.log(err);
       process.exit(1);
     }
     console.log("thumbnail uploaded");
     console.log(thumbResponse);
   }
 );
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Fix Youtube Thumbnails Not Showing - REGENDUS
1. Check Your Internet Speed. The most common thing that causes the youtube thumbnail fails to load is the connection. · 3. Clear...
Read more >
How To Fix YouTube Thumbnails Not Updating In Video ...
How to fix youtube thumbnails not updating. If like me you customise and change thumbnails on your youtube videos you may have had...
Read more >
How to Fix YouTube Thumbnails not showing (5 Solutions you ...
Some solutions might not work now as there may be other factors ... Go to Edge browser's Setting - Permission for this site...
Read more >
How to Fix Custom Thumbnail Problem on YouTube
Fix Custom Thumbnails Problem Quick and EasyJoin our Free Course How to Start a Business on YouTube in 7 Days ...
Read more >
YouTube Thumbnails Not Updating FIX
If like me you have updated your video thumbnail but then YouTube still shows the old one, here is why, what to do...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found