aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cs.js10
1 files changed, 9 insertions, 1 deletions
diff --git a/cs.js b/cs.js
index c3dbedd..b6b35c6 100644
--- a/cs.js
+++ b/cs.js
@@ -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 []
}