azlScrap/main.py

49 lines
1.4 KiB
Python
Raw Normal View History

#!/usr/bin/env python3
2021-12-20 20:11:44 +00:00
import azl
import letras
2021-12-20 20:11:44 +00:00
while True:
web = ''
val = ''
artist = input('Name of the artist/band: ')
title = input('Name of the song: ')
song_url = azl.getLink(artist, title)
un_lyr = azl.getLyrics(song_url)
fin = azl.parsero(un_lyr)
if fin == '<div id="RTK_u0kw"> <div id="RTK_YamI"> <div id="RTK_9uCq">':
fin = "Sorry I couldn't find that song :("
print('\n<------------------------------------------------------------->')
if fin != "Sorry I couldn't find that song :(":
print(fin)
else:
song_url = letras.getLink(artist, title)
un_lyr = letras.getLyrics(song_url)
fin = letras.parsero(un_lyr)
2022-02-14 21:48:00 +00:00
letra = fin.split('©', 1)
fin_lyr = letra[0]
2022-02-24 14:02:37 +00:00
l = fin_lyr.split('\n')
for x in l:
2022-02-24 14:12:47 +00:00
if len(x) > 0:
if x[0] == ' ':
x = x.replace(' ', '\n', 1)
2022-02-24 14:02:37 +00:00
print(x)
2021-12-20 20:11:44 +00:00
while True:
print('<------------------------------------------------------------->')
res = input("What's the move? (s to search for another song/q to quit): ")
if res == 's' or res == 'q':
val = res
break
else:
print("what's wrong w u mate?")
continue
if val == 's':
2021-12-20 20:11:44 +00:00
continue
elif val == 'q':
print('see u')
break
2021-12-20 20:11:44 +00:00
else:
print('SOMETHING WENT HORRIBLY WRONG GOTTA GO')
2021-12-20 20:11:44 +00:00
break