Upload files to ''
This commit is contained in:
parent
aa0f8f3c15
commit
36a2a8e15b
|
@ -0,0 +1,34 @@
|
|||
from bs4 import BeautifulSoup
|
||||
import requests
|
||||
from requests import get
|
||||
|
||||
def getLink(artist, title):
|
||||
base_start = 'https://www.letras.com/'
|
||||
artist = artist.lower()
|
||||
artist = artist.replace(' ', '-')
|
||||
title = title.lower()
|
||||
title = title.replace(' ', '-')
|
||||
link = base_start + artist + '/' + title
|
||||
return(link)
|
||||
|
||||
def getLyrics(link):
|
||||
w = requests.get(link)
|
||||
soup = BeautifulSoup(w.text, 'html.parser')
|
||||
lyr = soup.find_all('p', class_=False)
|
||||
let = str(lyr)
|
||||
return(let)
|
||||
|
||||
def parsero(lyrics):
|
||||
lyrics = lyrics.replace('</p>,', '\n')
|
||||
lyrics = lyrics.replace('<br/>,', '\n')
|
||||
lyrics = lyrics.replace('<br/>', '\n')
|
||||
lyrics = lyrics.replace('<p>', '')
|
||||
lyrics = lyrics.replace('<br>', '\n')
|
||||
lyrics = lyrics.replace('</br>', '\n')
|
||||
lyrics = lyrics.replace('<p style="display: none;">Quiero recibir notificaciones de artistas destacados y noticias.<span class="bt-toggle" id="js-toggle-push"></span></p>', '')
|
||||
lyrics = lyrics.replace('Música comienza con letras', '')
|
||||
lyrics = lyrics.replace('Asociados:', '')
|
||||
lyrics = lyrics.replace(' © 2003 - 2021, 3.1 millones de canciones', '')
|
||||
lyrics = lyrics.replace(' Hecho con <b>amor</b> en Belo Horizonte - Brasil', '')
|
||||
return('\n'+lyrics[1:-1])
|
||||
|
Loading…
Reference in New Issue