web selector removed (less annoying to use)
This commit is contained in:
parent
aa0f8f3c15
commit
8ba3ad1b6c
|
@ -1,63 +1,41 @@
|
||||||
from bs4 import BeautifulSoup
|
#!/usr/bin/env python3
|
||||||
import requests
|
|
||||||
from requests import get
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
def getLink():
|
import azl
|
||||||
artist = input('Name of the artist/band: ')
|
import letras
|
||||||
title = input('Name of the song: ')
|
|
||||||
base_start = 'https://www.azlyrics.com/lyrics/'
|
|
||||||
artist = artist.lower()
|
|
||||||
artist = artist.replace(' ', '')
|
|
||||||
artist = artist.replace('-', '')
|
|
||||||
title = title.lower()
|
|
||||||
title = title.replace(' ', '')
|
|
||||||
link = base_start + artist + '/' + title + '.html'
|
|
||||||
return(link)
|
|
||||||
|
|
||||||
def getLyrics(link):
|
|
||||||
w = requests.get(link)
|
|
||||||
soup = BeautifulSoup(w.text, 'html.parser')
|
|
||||||
lyr = soup.find_all('div', class_=False)
|
|
||||||
let = str(lyr)
|
|
||||||
return(let)
|
|
||||||
|
|
||||||
def parsero(lyrics):
|
|
||||||
let = lyrics
|
|
||||||
let = let.replace('<br/>', ' ')
|
|
||||||
let = let.replace('<i>', '')
|
|
||||||
let = let.replace('</i>', '')
|
|
||||||
let = let.replace('<div>', '')
|
|
||||||
let = let.replace('</div>,', '')
|
|
||||||
let = let.replace('</div>', '')
|
|
||||||
let = let.replace('<div id="RTK_vQAi">', '')
|
|
||||||
let = let.replace('<div id="RTK_QZjx">', '')
|
|
||||||
let = let.replace('<div id="RTK_sdL2">', '')
|
|
||||||
let = let.replace('<!-- Usage of azlyrics.com content by any third-party lyrics provider is prohibited by our licensing agreement. Sorry about that. -->', '')
|
|
||||||
return(let[1:-1])
|
|
||||||
|
|
||||||
while True:
|
while True:
|
||||||
song_url = getLink()
|
web = ''
|
||||||
lyrics_ori = getLyrics(song_url)
|
val = ''
|
||||||
fin = parsero(lyrics_ori)
|
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)
|
||||||
print(fin)
|
print(fin)
|
||||||
print('\n')
|
|
||||||
vali = ''
|
|
||||||
while True:
|
while True:
|
||||||
res = input("What's the move? (s to search/q to quit): ")
|
print('<------------------------------------------------------------->')
|
||||||
try:
|
res = input("What's the move? (s to search for another song/q to quit): ")
|
||||||
if res == 'q' or res == 's':
|
if res == 's' or res == 'q':
|
||||||
vali = res
|
val = res
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
print("I didn't give u that option dude")
|
print("what's wrong w u mate?")
|
||||||
except:
|
|
||||||
print('What?')
|
|
||||||
if vali == 'q':
|
|
||||||
print('See u!')
|
|
||||||
break
|
|
||||||
elif vali == 's':
|
|
||||||
continue
|
continue
|
||||||
else:
|
if val == 's':
|
||||||
print('Something went wrong')
|
continue
|
||||||
|
elif val == 'q':
|
||||||
|
print('see u')
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print('SOMETHING WENT HORRIBLY WRONG GOTTA GO')
|
||||||
break
|
break
|
||||||
|
|
Loading…
Reference in New Issue