From 30934b6326fded3db0c8181164522b4661ca4731 Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Wed, 31 May 2023 16:48:00 -0500 Subject: Add totally useful comments --- main.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/main.py b/main.py index 7bd135c..6ce8d21 100644 --- a/main.py +++ b/main.py @@ -3,18 +3,34 @@ import re import subprocess import sys import urllib.request +# NO EXTERNAL DEPENDENCIES YAY +# Wait does mpv count??? +# Gimme a video ID cur = sys.argv[1] while True: + # First start mpv in the background + # Make sure mpv doesn't take in any input + # Also enable subtitles because why not proc = subprocess.Popen(['mpv', '--no-video', '--no-input-default-bindings', '--slang=zh-CN', 'https://www.bilibili.com/video/' + cur]) try: + # I could use requests... + # Nope, external dependencies suck, so enjoy this abomination body = gzip.decompress(urllib.request.urlopen('https://www.bilibili.com/video/' + cur).read()).decode('utf-8') + # Sometimes I forget what I'm even listening to + # I WILL parse HTML with regex, you can't stop me print(cur, re.search('