Ask coding questions

← Back to all posts
How do i use BS4 and python? (ERROR)
AzureScripts (149)

I am trying to find a song title using genius it grabs the "top result" and looks for the name by doing

soup.find('div', {"class": "mini_card-title"})
but it returns None?

ash15khng (393)

You may need to replace the spaces in the title with %20.
Also, you should use an API for this, not scrape someone's website. You may get complaints if you use this a lot.

AzureScripts (149)

@ash15khng Nah it's fine uwu also, when you search normally with

search?q=Some Song Name, it brings you to the site anyway.

ash15khng (393)

@AzureScripts Oh I didn't know that. Anyways you could try

CBlockSurprise (16)

Maybe you have to use encodeURI() on the song name? But I don't know what it is in python