Code Monkey home page Code Monkey logo

Comments (8)

koltclassic avatar koltclassic commented on May 28, 2024 1

Not sure if this is useful information, but I had the same search running yesterday for probably 3.5 hours or so before it failed again with the same error. Still looking into solutions.

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

Hi! Thanks for pointing this out. I do rate limit the requests, but it doesn't sound like the issue you're describing is a result of that process. I recently addressed a bug (#44) that caused search_artist to slow down as more lyrics were added to the artist, but again, it sounds like the bug you're describing is different.

Are you using the latest version the project? What messages are printed out as the process slows (if any)? What artist are you searching for?

from lyricsgenius.

koltclassic avatar koltclassic commented on May 28, 2024

I'm using the latest version of the project. I ran a search_artist on 2Pac that ran for probably over an hour. It just error-ed out with the message below:

"Its Just Another Murder (Miqu Remix)" does not contain lyrics. Rejecting.
Song 210: "I've Seen Your Soul Before."
Song 211: "I Wonder If Heaven Got a Ghetto"
Song 212: "Jada"
Traceback (most recent call last):
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 386, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 382, in _make_request
    httplib_response = conn.getresponse()
  File "/Users/kolt/anaconda3/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/Users/kolt/anaconda3/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/Users/kolt/anaconda3/lib/python3.6/http/client.py", line 258, in _read_status
    line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
  File "/Users/kolt/anaconda3/lib/python3.6/socket.py", line 586, in readinto
    return self._sock.recv_into(b)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py", line 291, in recv_into
    raise timeout('The read operation timed out')
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 649, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/packages/six.py", line 686, in reraise
    raise value
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 600, in urlopen
    chunked=chunked)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 388, in _make_request
    self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/urllib3/connectionpool.py", line 308, in _raise_timeout
    raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='api.genius.com', port=443): Read timed out. (read timeout=5)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/kolt/dev/LyricsGenius/lyricsgenius/api.py", line 278, in search_artist
    song = Song(self.get_song(json_song['id']), lyrics)
  File "/Users/kolt/dev/LyricsGenius/lyricsgenius/api.py", line 74, in get_song
    return self._make_request(endpoint)
  File "/Users/kolt/dev/LyricsGenius/lyricsgenius/api.py", line 61, in _make_request
    params=params_)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 502, in request
    resp = self.send(prep, **send_kwargs)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/requests/sessions.py", line 612, in send
    r = adapter.send(request, **kwargs)
  File "/Users/kolt/anaconda3/lib/python3.6/site-packages/requests/adapters.py", line 516, in send
    raise ReadTimeout(e, request=request)
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host='api.genius.com', port=443): Read timed out. (read timeout=5)

I just restarted the 2Pac search. The first five or so songs were returned in the print list relatively quickly (less than a second per song) but it is currently hanging on song 8 (it has been there for a few minutes now with no error message)

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

Ah, okay. Thanks for all the details. It looks like this has something to do with me not properly handling the different possible responses that come from the Genius API. My guess is the API is complaining about something and sending a response to that effect, but the package doesn't handle the complaint properly.

I'll try to follow up with this issue this week. For now, you can wrap your code in a try: / except: and put it a long time.sleep(5*60) as a kludge. Not really a fix, but it might prevent your search getting scrapped after an hour.

Please feel free to follow up if you come up with a solution.

from lyricsgenius.

koltclassic avatar koltclassic commented on May 28, 2024

Will do! I usually stick to the JS realm, but hopefully I can help out. Thanks for looking into this, and thank you again for the wrapper!

from lyricsgenius.

koltclassic avatar koltclassic commented on May 28, 2024

👋 Hello! So I tried running the 2Pac query again, but this time on a much faster internet connection. I'm almost positive that was the issue as I'm ~150 songs in after only a couple minutes of the query running.

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

Oh, interesting! That's certainly good to here. I hope the search doesn't quit out on you again, but let me know if it does!

from lyricsgenius.

johnwmillr avatar johnwmillr commented on May 28, 2024

I'll close this issue for now as it sounds like you aren't having the same speed issues anymore. Let me know if it's still a problem.

from lyricsgenius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.