def letras(song):
    """
    Returns the lyrics found in letras.com for the specified mp3 file or an
    empty string if not found.
    """
    translate = {
        '&': 'a',
        URLESCAPE: '',
        ' ': '-'
    }
    artist = song.artist.lower()
    artist = normalize(artist, translate)
    title = song.title.lower()
    title = normalize(title, translate)

    url = 'https://www.letras.com/{}/{}/'.format(artist, title)
    soup = get_url(url)
    if not soup:
        return ''

    found_title = soup.select_one('div.cnt-head_title h1')
    if not found_title:
        # The site didn't find lyrics and took us to the homepage
        return ''

    found_title = found_title.get_text()
    found_title = re.sub(r'[\W_]+', '', found_title.lower())
    if found_title != re.sub(r'[\W_]+', '', song.title.lower()):
        # The site took us to the wrong song page
        return ''

    content = soup.find('article')
    if not content:
        return ''

    text = ''
    for br in content.find_all('br'):
        br.replace_with('\n')

    for p in content.find_all('p'):
        text += p.get_text() + '\n\n'

    return text.strip()
def letras ( song ) : translate = { '&' : 'a' , URLESCAPE : '' , ' ' : '-' } artist = song . artist . lower ( ) artist = normalize ( artist , translate ) title = song . title . lower ( ) title = normalize ( title , translate ) url = 'https://www.letras.com/{}/{}/' . format ( artist , title ) soup = get_url ( url ) if not soup : return '' found_title = soup . select_one ( 'div.cnt-head_title h1' ) if not found_title : return '' found_title = found_title . get_text ( ) found_title = re . sub ( r'[\W_]+' , '' , found_title . lower ( ) ) if found_title != re . sub ( r'[\W_]+' , '' , song . title . lower ( ) ) : return '' content = soup . find ( 'article' ) if not content : return '' text = '' for br in content . find_all ( 'br' ) : br . replace_with ( '\n' ) for p in content . find_all ( 'p' ) : text += p . get_text ( ) + '\n\n' return text . strip ( )
Returns the lyrics found in letras.com for the specified mp3 file or an
    empty string if not found.