diff options
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -26,15 +26,17 @@ while True: body = gzip.decompress(urllib.request.urlopen(url + 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('NOW PLAYING', cur, re.search('"true">(.*?)<', body).group(1)) + print('NOW PLAYING', url + cur, re.search('"true">(.*?)<', body).group(1)) # Get recommended stuff + lines = body.split('\n') rec = [ ( re.search('/video/(.*?)/', line).group(1), re.search('title="(.*?)"', line).group(1), - re.search('"name">(.*?)<', line).group(1) + re.search('"name">(.*?)<', line).group(1), + lines[i + 1].strip() ) - for line in body.split('\n') if 'recommend_more' in line + for i, line in enumerate(lines) if 'recommend_more' in line ] # Print it out the smart way! # Who needs loops smh |