aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xmain.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/main.py b/main.py
index a3f8c52..1b3be4c 100755
--- a/main.py
+++ b/main.py
@@ -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