Re-edit w3m-reddit script with .mobile fix

This commit is contained in:
Tyler Hallada 2015-04-24 16:11:50 -04:00
parent 4825ae89ca
commit f565688bcd

View File

@ -45,8 +45,17 @@ done
args+=("$@")
for arg in "${args[@]}" ; do
# Switch to mobile reddit
url=${arg/http:\/\/reddit.com/https:\/\/m.reddit.com}
url=${url/http:\/\/www.reddit.com/https:\/\/m.reddit.com}
url=$arg
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
url=${url/\/\/comments/\/comments}
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
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
desktop version, though. It also doesn't work over http, so I edited the script
to always switch to https.
good in w3m. However, the old mobile site is still accessable by adding a
".mobile" to the end of urls. The script above has been edited to reflect this
change.