From 430dd8d20c48bb5b7d4d432efc564d02fef5fdaa Mon Sep 17 00:00:00 2001 From: Anthony Wang Date: Wed, 31 May 2023 18:34:59 -0500 Subject: Add even more comments yay! --- main.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/main.py b/main.py index 1b3be4c..224aa6c 100755 --- a/main.py +++ b/main.py @@ -28,13 +28,14 @@ while True: # I WILL parse HTML with regex, you can't stop me print('NOW PLAYING', url + cur, re.search('"true">(.*?)<', body).group(1)) # Get recommended stuff + # I figured out the regexes by playing around with curl --compressed and then grepping lines = body.split('\n') rec = [ ( - re.search('/video/(.*?)/', line).group(1), - re.search('title="(.*?)"', line).group(1), - re.search('"name">(.*?)<', line).group(1), - lines[i + 1].strip() + re.search('/video/(.*?)/', line).group(1), # ID + re.search('title="(.*?)"', line).group(1), # Video name + re.search('"name">(.*?)<', line).group(1), # up主 name + lines[i + 1].strip() # View count ) for i, line in enumerate(lines) if 'recommend_more' in line ] -- cgit v1.2.3-70-g09d2