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/instagram.js | 2 +- content_scripts/bridges/twitter.js | 10 ++++++++-- content_scripts/bridges/youtube.js | 9 +++++---- 3 files changed, 14 insertions(+), 7 deletions(-) (limited to 'content_scripts/bridges') diff --git a/content_scripts/bridges/instagram.js b/content_scripts/bridges/instagram.js index 0ced06a..18988b9 100644 --- a/content_scripts/bridges/instagram.js +++ b/content_scripts/bridges/instagram.js @@ -7,4 +7,4 @@ async function get_insta() { let feed_url = `${base_url}/?action=display&bridge=Instagram&context=Username&u=${uid}&media_type=all&format=`; return get_all_types(feed_url) } - +register(["instagram"], get_insta) diff --git a/content_scripts/bridges/twitter.js b/content_scripts/bridges/twitter.js index e9855cb..1ffa131 100644 --- a/content_scripts/bridges/twitter.js +++ b/content_scripts/bridges/twitter.js @@ -4,9 +4,15 @@ function get_twitter() { let match = url.match(pattern); if (match) { let twitter_handle = match[1] + let feed_url = `${base_url}/?action=display&bridge=Twitter&context=By+username&u=${twitter_handle}&format=` - return get_all_types(feed_url) + let feeds = get_all_types(feed_url) + + let feed_url_norep = `${base_url}/?action=display&bridge=Twitter&context=By+username&u=${twitter_handle}&norep=on&format=` + let feeds_norep = get_all_types(feed_url, "no replies") + + return feeds.concat(feeds_norep) } return [] } - +register(["twitter"], get_twitter) 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