diff options
author | Anthony Wang | 2023-05-31 18:34:59 -0500 |
---|---|---|
committer | Anthony Wang | 2023-05-31 18:34:59 -0500 |
commit | 430dd8d20c48bb5b7d4d432efc564d02fef5fdaa (patch) | |
tree | 02488a4fe8a3242aca48f494ab339adbd5beec26 | |
parent | 35b0d4c3960c2ec7972cdff3a639925e497efb1d (diff) |
Add even more comments yay!
-rwxr-xr-x | main.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 ] |