mirror of
https://github.com/tubearchivist/browser-extension.git
synced 2024-11-05 03:30:12 +00:00
fix regex for matching urls with - in id
This commit is contained in:
parent
fb642282a9
commit
7007a920c1
@ -24,11 +24,11 @@ function getBrowser() {
|
||||
|
||||
function detectUrlType(url) {
|
||||
|
||||
const videoRe = new RegExp(/^https:\/\/(www\.)?(youtube.com\/watch\?v=|youtu\.be\/)\w{11}/);
|
||||
const videoRe = new RegExp(/^https:\/\/(www\.)?(youtube.com\/watch\?v=|youtu\.be\/)[\w-]{11}/);
|
||||
if (videoRe.test(url)) {
|
||||
return "video"
|
||||
}
|
||||
const channelRe = new RegExp(/^https:?\/\/www\.?youtube.com\/c|channel|user\/\w+(\/|featured|videos)?$/);
|
||||
const channelRe = new RegExp(/^https:?\/\/www\.?youtube.com\/c|channel|user\/[\w-]+(\/|featured|videos)?$/);
|
||||
if (channelRe.test(url)) {
|
||||
return "channel"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user