Quick and dirty URL swaps
~/bin/xdg-open:
#!/bin/sh
PARM="$*"
PARM=$(echo "$PARM" | sed 's/www.twitter.com/nitter.net/g')
PARM=$(echo "$PARM" | sed 's/twitter.com/nitter.net/g')
PARM=$(echo "$PARM" | sed 's/www.instagram.com/bibliogram.art/g')
PARM=$(echo "$PARM" | sed 's/instagram.com/bibliogram.art/g')
PARM=$(echo "$PARM" | sed 's/www.youtube.com/invidious.fdn.fr/g')
PARM=$(echo "$PARM" | sed 's/youtube.com/invidious.fdn.fr/g')
PARM=$(echo "$PARM" | sed 's/youtu.be\//invidious.fdn.fr\/watch?v=/g')
/usr/bin/xdg-open "$PARM"
Somebody asked, so I figured I might as well post what I now use.
I don't know the people behind these services, but they're very fast
on my machine... so I use them a lot of the time.
Are there more frontends/scrapers to services like that?
Edit 9:33 PM:
Current update to the script:
#!/bin/sh
VIDEO_IN_PLAYER=1
VIDEO_PLAYER="konsole -e mpv -v"
PARM="$*"
PARM=$(echo "$PARM" | sed 's/www.twitter.com/nitter.net/g')
PARM=$(echo "$PARM" | sed 's/twitter.com/nitter.net/g')
PARM=$(echo "$PARM" | sed 's/www.instagram.com/bibliogram.art/g')
PARM=$(echo "$PARM" | sed 's/instagram.com/bibliogram.art/g')
PARM=$(echo "$PARM" | sed 's/www.youtube.com/invidious.snopyta.org/g')
PARM=$(echo "$PARM" | sed 's/youtube.com/invidious.snopyta.org/g')
PARM=$(echo "$PARM" | sed 's/youtu.be\//invidious.snopyta.org\/watch?v=/g')
# This currently only supports a single URL parameter
if [ "$VIDEO_IN_PLAYER" == "1" ]; then
# ignore user channels and the like
VIDEO=$(echo "$PARM" | grep "invidious.snopyta.org\/watch?v=")
if [ "$VIDEO" != "" ]; then
$VIDEO_PLAYER "$1"
exit
fi
fi
PLATFORM=$(uname -s | grep OpenBSD)
if [ "$PLATFORM" == "" ]; then
/usr/bin/xdg-open "$PARM"
else
/usr/local/bin/xdg-open "$PARM"
fi
-- Marco