diff options
Diffstat (limited to 'main.py')
-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 ] |