heiseonline / embetty-server

🐙 Proxy and provider of data for heiseonline/embetty
MIT License
161 stars 16 forks source link

YouTube IDs with dashes #5

Closed medizinundmedien closed 6 years ago

medizinundmedien commented 6 years ago

The \w metacharacter at https://github.com/heiseonline/embetty-server/blob/7c7e751a6f423250919731d2019dc57d56972fb5/routes/video/youtube.js#L8 won't match all YouTube video IDs. YouTube video IDs can contain dashes (-) and underscores (_) – examples below:

https://www.youtube.com/watch?v=ZW9O45G-J1c https://www.youtube.com/watch?v=RtU_mdL2vBM https://www.youtube.com/watch?v=TK0-Qi0_SHg

A "better" pattern would check those characters with a length of 11 characters: /^[-_a-zA-Z0-9]{11}$/ instead of /^\w+$/

compeak commented 6 years ago

Thank you for reporting this bug. It has been fixed in 4aa837895eb7ae5be43a8f2b126c287a9c25573d and v1.0.0.

\w contains _.