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/page-extractors/mastodon

27 lines
620 B
Plaintext

# check for explicit feed link
page_ext=`echo $content | grep -Po "(?<=<link href=').*?(?=' rel='alternate' type='application/rss\+xml'>)" | head -1`
page_ext=${page_ext##*href=\'}
# if explicit feed link not found get user URL and add .rss
if [[ "$page_ext" == "" ]]
then
determine_protocol
get_domain
username="${url##*//}"
username="${username#*/}"
if [[ "$username" == @* ]]
then
username="${username%%/*}"
elif [[ "$username" == users/* ]]
then
username="${username#*/}"
username="users/${username%%/*}"
fi
if [[ -n "$username" ]]
then
page_ext="${protocol}${domain}/${username}.rss"
fi
fi