youtube-regex
youtube-regex copied to clipboard
Some youtube/tv links not working
It doesn't work on some youtube.com/tv links
- Doesn't work: https://www.youtube.com/tv#/watch/video/idle?v=oNXzMBA9VU4&resume
- Doesn't work: https://www.youtube.com/tv#/watch/video/idle?v=oNXzMBA9VU4
- Doesn't work: https://www.youtube.com/tv#/watch/video/seek?v=oNXzMBA9VU4
- Doesn't work: https://www.youtube.com/tv#/watch/video/control?v=oNXzMBA9VU4
- Doesn't work: https://www.youtube.com/tv#/watch/video?v=oNXzMBA9VU4
- Doesn't work: https://www.youtube.com/tv#/watch?v=c7GVeJJcD5w&list=UUFZO6aPugMrZjUOobX7IQDA
- Works : https://www.youtube.com/tv#/watch?v=oNXzMBA9VU4
related: https://github.com/rg3/youtube-dl/issues/11485
Thanks for the report.
It seems like a simple fix, but I'll investigate more later tonight.
edit: http://regexr.com/3etii - just with simple (?:.*), but that with /control fails (because we search for between 6 and 11, duh)
Simplest and fastest fix currently is change from above and (?!control), so
const regex = /(?:youtube\.com\/\S*(?:(?:\/e(?:mbed))?\/|watch(?:.*)\?(?:\S*?&?v\=))|youtu\.be\/)((?!control)[a-zA-Z0-9_-]{6,11})/;
http://regexr.com/3gbp9