Zod- / jsVideoUrlParser

A javascript parser to extract informations like provider, channel, id, start time from YouTube, Vimeo, Dailymotion, Twitch,... urls
MIT License
234 stars 73 forks source link

Handle non existing Youtube imageQuality-ies #61

Closed ligne13 closed 4 years ago

ligne13 commented 4 years ago

Hi,

This is a not bug in this library, but a question.

I want to get the URL of a Youtube image at the highest resolution available:

const url = urlParser.create({
            videoInfo: parse,
            params: {
              imageQuality: 'maxresdefault'
            },
            format: 'shortImage'
          });

Sometimes Youtube videos do not provide maxresdefault images and the URL return a 404. I need to test that a maxresdefault image exists and if not, get the hqdefault quality. But I cannot test the existence of the Youtube URL (with fetch or axios) because of CORS restrictions.

How I can test that a CORS URL is not a 404 ?

thanks

Zod- commented 4 years ago

You can use the youtube API to get an actual list of images/thumbnails for a video