-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlive.py
46 lines (30 loc) · 1.04 KB
/
live.py
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
import argparse
import streamlink
parser = argparse.ArgumentParser()
parser.add_argument ('--url',type=str)
args = parser.parse_args()
a=1
while True:
try:
streams=streamlink.streams(args.url)
except IOError as e:
a=a+1
if a==5:
print("disconnected")
break
except Exception as e:
a=a+1
if a==5:
print("disconnected")
break
else:
try:
streams["best"].url
print("live")
break
except IOError as e:
print("off line")
break
except Exception as e:
print("off line")
break