-
Notifications
You must be signed in to change notification settings - Fork 19
/
tv.sh
executable file
·85 lines (77 loc) · 3 KB
/
tv.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
PLAYER="mpv"
TITLES=(
"RTP 1"
"RTP 2"
"SIC"
"TVI"
"RTP 3"
"SIC Notícias"
"CNN Portugal"
"RTP Memória"
"RTP Madeira"
"RTP Açores"
"RTP África"
"RTP Internacional"
"TVI Internacional"
"TVI Ficção"
"TVI Reality"
"ARTV"
"Porto Canal"
"Euronews"
"Canal 11"
"Kuriakos TV"
)
STREAMS=(
"https://streaming-live-app.rtp.pt/liverepeater/smil:rtp1HD.smil/rtp_playlist.m3u8"
"https://streaming-live-app.rtp.pt/liverepeater/smil:rtp2HD.smil/rtp_playlist.m3u8"
"https://d1zx6l1dn8vaj5.cloudfront.net/out/v1/b89cc37caa6d418eb423cf092a2ef970/index.m3u8"
"__tvi"
"https://streaming-live-app.rtp.pt/liverepeater/smil:rtpnHD.smil/rtp_playlist.m3u8"
"--referrer=https://sic.pt/ https://sicnot.live.impresa.pt/sicnot.m3u8"
"__cnnportugal"
"__rtp rtpmemoria"
"__rtp rtpmadeira"
"__rtp rtpacores"
"__rtp rtpafrica"
"__rtp rtpinternacional"
"__tviint"
"https://video-auth2.iol.pt/live_tvi_ficcao/live_tvi_ficcao/edge_servers/tvificcao-720p/playlist.m3u8"
"https://video-auth2.iol.pt/live_tvi_direct/live_tvi_direct/edge_servers/tvireality-480p/playlist.m3u8"
"https://playout175.livextend.cloud/livenlin4/2liveartvpub2/playlist.m3u8"
"--referrer='http://sapo.pt/' https://streamer-b02.videos.sapo.pt/live/portocanal/playlist.m3u8"
"https://rakuten-euronews-8-pt.samsung.wurl.com/manifest/playlist.m3u8"
"https://d2ve4fchffi4n1.cloudfront.net/out/v1/df356edd16f3434ab417f2c48cb1d516/index.m3u8"
"http://195.22.11.11:1935/ktv/ktv2/playlist.m3u8"
)
# as seen at https://stackoverflow.com/a/37840948
function urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
# dynamic streams
__rtp() { urldecode $(wget https://www.rtp.pt/play/direto/$1 -O - -o /dev/null | grep hls | sed 's/.*hls: //g' | sed 's/, dash.*//g' | sed 's/.*\[//g' | sed 's/\].*//g' | sed 's/[",]//g'); }
__tvi() { echo "https://video-auth6.iol.pt/live_tvi/live_tvi/playlist.m3u8?wmsAuthSign=$(wget https://services.iol.pt/matrix?userId= -o /dev/null -O -)"; }
__cnnportugal() { echo "https://video-auth6.iol.pt/live_cnn/live_cnn/playlist.m3u8?wmsAuthSign=$(wget https://services.iol.pt/matrix?userId= -o /dev/null -O -)"; }
__tviint() { echo "https://video-auth6.iol.pt/live_tvi_internacional/live_tvi_internacional/playlist.m3u8?wmsAuthSign=$(wget https://services.iol.pt/matrix?userId= -o /dev/null -O -)"; }
#random string for user-agent to avoid blacklists
USER_AGENT=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 50)
# check if dependencies exist
type $PLAYER &>/dev/null || { echo "$PLAYER is not installed"; exit 1; }
PS3="Which TV channel do you want to watch? "
select choice in "${TITLES[@]}";
do
if [[ -n $choice ]]; then
for i in ${!TITLES[@]}
do
if [ "${TITLES[i]}" = "$choice" ]; then
# check if dynamic stream
if [ "${STREAMS[i]:0:2}" = "__" ]; then
$PLAYER --user-agent="$USER_AGENT" $(${STREAMS[i]})
else
$PLAYER --user-agent="$USER_AGENT" ${STREAMS[i]}
fi
break
fi
done
else
echo "Invalid selection."
fi
done