Ask coding questions

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

I am trying to find a song title using genius

https://genius.com/search?q=Wrecking%20ball it grabs the "top result" and looks for the name by doing

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

Commentshotnewtop
1
ash15khng (208)

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.

1
AzureScripts (130)

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

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

1
ash15khng (208)

@AzureScripts Oh I didn't know that. Anyways you could try soup.select().

1
CBlockSurprise (16)

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