diff options
author | Mark Powers <mark@marks.kitchen> | 2022-12-30 13:58:20 -0600 |
---|---|---|
committer | Mark Powers <mark@marks.kitchen> | 2022-12-30 13:58:20 -0600 |
commit | 3bdc11a9b2c78f2be8c11d28befce7328b6e5424 (patch) | |
tree | 98a88b435bf14f71a28537a0e5c8e052ab58a78c /content_scripts/bridges/youtube.js | |
parent | b5c10718ddeaa8fcac368515ca150705b1a2c5ab (diff) |
Improve RSS preview
Diffstat (limited to 'content_scripts/bridges/youtube.js')
-rw-r--r-- | content_scripts/bridges/youtube.js | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/content_scripts/bridges/youtube.js b/content_scripts/bridges/youtube.js index 202873b..e6b584c 100644 --- a/content_scripts/bridges/youtube.js +++ b/content_scripts/bridges/youtube.js @@ -31,7 +31,7 @@ async function get_youtube() { let patternListInVideo = /youtube.com\/watch\?v=\w+\&list=(\w+)/ let matchListInVideo = url.match(patternListInVideo) - if(matchListInVideo){ + if(matchListInVideo && matchListInVideo[1]){ let playlistId = matchListInVideo[1] let playlist_feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+playlist+Id&p=${playlistId}&duration_min=&duration_max=&format=` let native_url = get_native_playlist_feed(playlistId) @@ -41,17 +41,17 @@ async function get_youtube() { return feeds } - if (matchUser) { + if (matchUser && matchUser[1]) { let user = matchUser[1]; let feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+username&u=${user}&duration_min=&duration_max=&format=` return get_all_types(feed_url) } - if (matchChannel) { + if (matchChannel && matchChannel[1]) { let channelId = matchChannel[1] let feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+channel+id&c=${channelId}&duration_min=&duration_max=&format=` return get_all_types(feed_url) } - if (matchPlaylist) { + if (matchPlaylist && matchPlaylist[1]) { let playlistId = matchPlaylist[1] let native_url = get_native_playlist_feed(playlistId) let feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+playlist+Id&p=${playlistId}&duration_min=&duration_max=&format=` @@ -61,3 +61,4 @@ async function get_youtube() { return [] } +register(["youtube"], get_youtube) |