From 71b2bda6e0d29bafe8257d5c3a497dbc12e2b9c3 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Wed, 31 May 2023 16:41:45 -0500 Subject: Add main.py --- main.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 main.py diff --git a/main.py b/main.py new file mode 100644 index 0000000..7bd135c --- /dev/null +++ b/main.py @@ -0,0 +1,20 @@ +import gzip +import re +import subprocess +import sys +import urllib.request + +cur = sys.argv[1] +while True: + proc = subprocess.Popen(['mpv', '--no-video', '--no-input-default-bindings', '--slang=zh-CN', 'https://www.bilibili.com/video/' + cur]) + try: + body = gzip.decompress(urllib.request.urlopen('https://www.bilibili.com/video/' + cur).read()).decode('utf-8') + print(cur, re.search('