This repository has been archived on 2021-11-29. You can view files and clone it, but cannot push or open issues or pull requests.
rsstube-bash-old/scripts/url-extractors/invidious

40 lines
729 B
Plaintext

# determine whether HTTP or HTTPS
# Tor instances may not use HTTPS
determine_protocol
get_domain
instance=${protocol}${domain}
# get feed if able
channel_id=""
list=""
if [[ $url == *"/channel/"* ]]
then
channel_id=${url#*/channel/}
# Invidious just redirects /user/ to /channel/ anyway
elif [[ $url == *"/user/"* ]]
then
channel_id=${url#*/user/}
# playlist
elif [[ $url == *"&list="* ]]
then
list=${url#*&list=}
list=${list%%&*}
fi
# trim extra arguments
channel_id=${channel_id%%\?*}
channel_id=${channel_id%%\&*}
if [[ -n $channel_id ]]
then
channel_id=${channel_id%%/*}
rss="${instance}/feed/channel/${channel_id}"
url_ext=$rss
elif [[ -n $list ]]
then
rss="${instance}/feed/playlist/${list}"
url_ext=$rss
fi