Re-edit w3m-reddit script with .mobile fix

This commit is contained in:
Tyler Hallada 2015-04-24 16:11:50 -04:00
parent de223c1efa
commit fd63ee7c69

View File

@ -45,8 +45,17 @@ done
args+=("$@") args+=("$@")
for arg in "${args[@]}" ; do for arg in "${args[@]}" ; do
# Switch to mobile reddit # Switch to mobile reddit
url=${arg/http:\/\/reddit.com/https:\/\/m.reddit.com} url=$arg
url=${url/http:\/\/www.reddit.com/https:\/\/m.reddit.com} mobile='.mobile'
if [[ $url =~ http:\/\/www.reddit.com || $url =~ http:\/\/reddit.com ]]
then
if [[ $url =~ \/$ ]]
then
url=$url$mobile
else
url=$url'/'$mobile
fi
fi
# Fix double backslash error in comment uri for mobile reddit # Fix double backslash error in comment uri for mobile reddit
url=${url/\/\/comments/\/comments} url=${url/\/\/comments/\/comments}
if [[ $t == "1" ]]; then if [[ $t == "1" ]]; then
@ -96,6 +105,6 @@ command-line.
EDIT 04/25/2015: Reddit seems to have gotten rid of their old mobile reddit site EDIT 04/25/2015: Reddit seems to have gotten rid of their old mobile reddit site
and replaced it with a more modern version that unfortunately doesn't look as and replaced it with a more modern version that unfortunately doesn't look as
good in w3m. It still gets rid of a lot of header junk that is present in the good in w3m. However, the old mobile site is still accessable by adding a
desktop version, though. It also doesn't work over http, so I edited the script ".mobile" to the end of urls. The script above has been edited to reflect this
to always switch to https. change.