-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.py
37 lines (27 loc) · 890 Bytes
/
main.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
from downloader.utils import *
# import codecs
from selenium import webdriver
if __name__ == "__main__":
url = input("twitter broadcast url: ")
driver = webdriver.Chrome()
driver.get(url)
driver.execute_script(open("downloader/listener.js", "r").read())
data = ""
while not data:
for i in driver.get_log("browser"):
if (
"message" in i
and "source" in i
and i["source"] == "console-api"
and ".m3u8" in i["message"]
):
data = i["message"]
driver.quit()
# file = codecs.open("temp", "w", "utf-8")
# file.write(data)
# file.close()
# data = open("temp", "r", encoding="utf-8").read()
m3u8_url = extract_m3u8_url(data)
download(m3u8_url)
# remove_file("temp")
print("Done!")