youtube-regex icon indicating copy to clipboard operation
youtube-regex copied to clipboard

Support Youtube thumbnail URLs

Open augbog opened this issue 10 years ago • 4 comments

Is there a way we can have it so this module supports Youtube thumbnail URLs? Here is a relevant Stackoverflow question.

Ideally the regex would support URLs such as

https://img.youtube.com/vi/<insert-youtube-video-id-here>/default.jpg
https://img.youtube.com/vi/<insert-youtube-video-id-here>/hqdefault.jpg

Along with the other quality thumbnails.

augbog avatar Jul 17 '15 00:07 augbog

Hi and thanks for this issue. I will review it in the weekend or sooner

tunnckoCore avatar Jul 17 '15 00:07 tunnckoCore

@augbog hm, or it's pretty easy http://regexr.com/3bdh0 like this?

haha, it's going to be more and more better than ever and than every other implementation!

^ Nope, exactly, :cat2:

// thumbnails
img.youtube.com/vi/0EWbonj7f18/default.jpg
i.ytimg.com/vi_webp/WijF8aivOo8/mqdefault.webp
i1.ytimg.com/vi/G0wGs3useV8/0.jpg
img.youtube.com/vi/G0wGs3useV8/3.jpg

that are with number like /3.jpg works, but not the others like /default.jpg, so yea... I can continue in weekend.

tunnckoCore avatar Jul 17 '15 00:07 tunnckoCore

Yup that looks about right. I'm not sure what exactly the different urls are (all the ones listed in the Stackoverflow question are ones I go off of) and it seems to work fine. The regex you use for the youtube video id should be the same though in the middle part of the url.

Here's more info on Video thumbnails if it helps!

augbog avatar Jul 17 '15 07:07 augbog

/cc @regexps/owners thoughts? this change (?:ytimg|youtube) seems to fixes the issue partially what more?

tunnckoCore avatar Jul 17 '15 12:07 tunnckoCore