Last active
December 26, 2015 16:29
-
-
Save cirrusUK/7180568 to your computer and use it in GitHub Desktop.
watch live TV in VLC/MPV/Mplayer etc (#UK IP & account over at http://tvcatchup.com required.)
moar info > http://cirrusminor.info/2013/10/19/uk-linux-users-watch-tv-in-vlc-mplayer/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
clear | |
ua="BlackBerry9000/4.6.0.167 Profile/MIDP-2.0 Configuration/CLDC-1.1 VendorID/102" | |
username="username from http://tvcatchup.com" #before using this script you will need an acc at http://tvcatchup.com | |
password="password from http://tvcatchup.com" #before using this script you will need an acc at http://tvcatchup.com | |
player="mpv" #can edit to prefered player | |
dati=`wget -U "$ua" --no-check-certificate --save-cookies=cookie.txt -q --keep-session-cookies "http://m.tvcatchup.com" -O-` | |
hash=`echo "$dati" | grep -o "&hash=[^&]*" | cut -d"=" -f2` | |
list=`echo "$dati" | grep -o '<a href="#" onclick="javascript:loadChannel([^)]*' | cut -d'(' -f2 | sed "s#, '#) #g" | sed "s#'##g"` | |
check=`wget -U "$ua" --save-cookies=cookie.txt --load-cookies=cookie.txt --keep-session-cookies --no-check-certificate --header "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" --header "X-Requested-With: XMLHttpRequest" --header "Referer: http://m.tvcatchup.com/" --post-data="username=${username}&hash=${hash}&password=${password}" "http://m.tvcatchup.com/?login=1" -q -O-` | |
if [ "$check" != "success" ]; then | |
rm cookie.txt | |
echo "There's a error with the login form. Check your account information !" | |
sleep 5 | |
exit 1 | |
fi | |
while [ -z "$x" ]; do | |
clear | |
echo "Channels list:" | |
echo "" | |
echo "$list" | |
echo "" | |
echo -n "Choose a channel or press x to exit: " | |
read num | |
if [ "$num" == "x" ]; then | |
rm cookie.txt | |
clear | |
exit 0 | |
fi | |
url=`wget -U "$ua" --load-cookies=cookie.txt --keep-session-cookies --no-check-certificate "http://m.tvcatchup.com/?chan=$num" -O- 2>&1 | grep -o "rtsp://[^ ]*" | sed -n "1p"` | |
clear | |
echo "Start of streaming in progress..." | |
$player "$url" 2>/dev/null | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment