johnwmillr / LyricsGenius

Download song lyrics and metadata from Genius.com 🎶🎤
http://www.johnwmillr.com/scraping-genius-lyrics/
MIT License
898 stars 159 forks source link

TypeError When search for artist or song #115

Closed NTNguyen13 closed 4 years ago

NTNguyen13 commented 4 years ago

Describe the bug genius.search_song andgenius.search_artist resulted in TypeError: super(type, obj): obj must be an instance or subtype of type

To Reproduce I followed the example exactly: 1.

import lyricsgenius
genius = lyricsgenius.Genius("client access token")
  1. artist = genius.search_artist("Andy Shauf", max_songs=3, sort="title")

Error

Traceback (most recent call last):

  File "<ipython-input-39-507df3c03fe2>", line 1, in <module>
    artist = genius.search_artist("Andy Shauf", max_songs=3, sort="title")

  File "/home/lucis/anaconda3/lib/python3.7/site-packages/lyricsgenius/api.py", line 351, in search_artist
    lyrics = self._scrape_song_lyrics_from_url(song_info['url'])

  File "/home/lucis/anaconda3/lib/python3.7/site-packages/lyricsgenius/api.py", line 168, in _scrape_song_lyrics_from_url
    html = BeautifulSoup(page.text, "html.parser")

  File "/home/lucis/anaconda3/lib/python3.7/site-packages/bs4/__init__.py", line 166, in __init__
    builder = builder_class()

  File "/home/lucis/anaconda3/lib/python3.7/site-packages/bs4/builder/_htmlparser.py", line 218, in __init__
    "Python's built-in HTMLParser cannot parse the given document. This is not a bug in Beautiful Soup. The best solution is to install an external parser (lxml or html5lib), and use Beautiful Soup with that parser. See http://www.crummy.com/software/BeautifulSoup/bs4/doc/#installing-a-parser for help."))

TypeError: super(type, obj): obj must be an instance or subtype of type

Version info

I already installed htm5lib but this still occurs

Please help me with this issue, thank you very much

johnwmillr commented 4 years ago

I've used lxml in the past, not html5lib. I'm not sure if that's the issue, but it'd be worth trying.

johnwmillr commented 4 years ago

@NTNguyen13, is this issue resolved?

NTNguyen13 commented 4 years ago

@johnwmillr Hi, sorry for not replying sooner, yes, it was solved, I forgot to mark this issue