diff options
Diffstat (limited to 'cs.js')
-rw-r--r-- | cs.js | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -74,6 +74,12 @@ function get_twitter(url) { } async function get_youtube(url) { + // use link to channel if given a video url + let patternVideo = /youtube.com\/watch\?v=\w+/ + if (url.match(patternVideo)) { + url = document.querySelector("#channel-name a")["href"] + } + let patternUser = /youtube.com\/user\/(\w+).*/ let matchUser = url.match(patternUser) @@ -82,6 +88,8 @@ async function get_youtube(url) { let patternPlaylist = /youtube.com\/playlist\?list=(\w+)/ let matchPlaylist = url.match(patternPlaylist) + + if (matchUser) { let user = matchUser[1]; let feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+username&u=${user}&duration_min=&duration_max=&format=` @@ -96,7 +104,7 @@ async function get_youtube(url) { let feed_url = `${base_url}/?action=display&bridge=Youtube&context=By+playlist+Id&p=${playlistId}&duration_min=&duration_max=&format=` let rb_feeds = get_all_types(feed_url) return rb_feeds.concat([{ type: `native: Rss`, url: native_url }]) - } + } return [] } |