From 3bdc11a9b2c78f2be8c11d28befce7328b6e5424 Mon Sep 17 00:00:00 2001 From: Mark Powers Date: Fri, 30 Dec 2022 13:58:20 -0600 Subject: Improve RSS preview --- content_scripts/bridges/youtube.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'content_scripts/bridges/youtube.js') 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) -- cgit v1.2.3