Delete 'main.py'
This commit is contained in:
parent
36a2a8e15b
commit
daba81de06
63
main.py
63
main.py
|
@ -1,63 +0,0 @@
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
import requests
|
|
||||||
from requests import get
|
|
||||||
import webbrowser
|
|
||||||
|
|
||||||
def getLink():
|
|
||||||
artist = input('Name of the artist/band: ')
|
|
||||||
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:
|
|
||||||
song_url = getLink()
|
|
||||||
lyrics_ori = getLyrics(song_url)
|
|
||||||
fin = parsero(lyrics_ori)
|
|
||||||
print(fin)
|
|
||||||
print('\n')
|
|
||||||
vali = ''
|
|
||||||
while True:
|
|
||||||
res = input("What's the move? (s to search/q to quit): ")
|
|
||||||
try:
|
|
||||||
if res == 'q' or res == 's':
|
|
||||||
vali = res
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print("I didn't give u that option dude")
|
|
||||||
except:
|
|
||||||
print('What?')
|
|
||||||
if vali == 'q':
|
|
||||||
print('See u!')
|
|
||||||
break
|
|
||||||
elif vali == 's':
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
print('Something went wrong')
|
|
||||||
break
|
|
Loading…
Reference in New Issue