rembo10 / headphones

Automatic music downloader for SABnzbd
GNU General Public License v3.0
3.36k stars 602 forks source link

Last.FM returned an error: Rate Limit Exceeded #3207

Open ChaosBlades opened 5 years ago

ChaosBlades commented 5 years ago

Last.FM returned an error: Rate Limit Exceeded - This application has made too many requests in a short period. If this is your API key, see https://www.last.fm/api/tos#4.4 for information about raising the limit.

I just added two artists and it didn't add either of their artwork. So I am pretty sure I didn't hit the rate limit. Doesn't look like this issue has been posted yet but everyone that uses Headphones should be getting it.

nonamethanks commented 5 years ago

Can confirm, last.fm is not fetching any image for me.

rantanlan commented 5 years ago

looks like they changed it https://getsatisfaction.com/lastfm/topics/api-announcement-dac8oefw5vrxq

nine13tech commented 5 years ago

We could change this to take an API key from the config file instead of the apps' hard-coded API key in https://github.com/rembo10/headphones/blob/master/headphones/lastfm.py I'll see if I can work on a rudimentary fix for this and have it pull from the ini file.

rantanlan commented 5 years ago

I already tried to add my own api key, but the issue stays the same. But I'm no coder by any means... so not sure.

ChaosBlades commented 5 years ago

Last.fm has completely removed the ability to pull artwork via the API. Check out the link in the second reply.

nine13tech commented 5 years ago

Upon deeper inspection (yes - artwork is not pullable now) we are violating the number of requests per minute per IP. so an API key issue is not really the thing, it's the number of time we are asking for something per second. I get why they did this, there are other options out there like muzicbrains, I will look today at what some of the others are using - like Lidarr ( if I can wade through the C# :| ) Sorry for GitHubbing prior to coffee.

ChaosBlades commented 5 years ago

Not exactly. They removed it period. For everyone regardless of how many calls. The error message is missleading.

"While we allow API users to have access to a lot of data through the API, it has always been against our API Terms of Use for third parties to use audio, audiovisual, images or artwork. In some instances, some data may have been indirectly accessible through a small number of API calls, and so as part of the recent API clean-up, we have corrected that anomaly."

nine13tech commented 5 years ago

ChaosBlades, sorry I was not more clear - yes they removed a number of things from the API, including album artwork. That said, your assumption that because the artwork is missing from the JSON payload that we are getting a rate limit error is not quite correct. In the LastFM.py code we make a call to the API for as much data as we can get our greedy little paws on; artwork included (which fails). I suspect (but have not verified in the code) that upon failure to have the artwork, we are then retrying, multiple times for different albums, and thusly hitting the 5 calls per minute limit (or whatever it really is now since I can't find that posted anywhere) and now we get what we are perceiving as a failed call that is because the artwork is missing. As you can see in this log, there are a number of successful calls to the API before I get rate limited.


29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-6 : Last.FM call parameters: {'mbid': u'6cb79cb2-9087-44d4-828b-5c6fdff2c957', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-6 : Requesting URL via GET method: http://ws.audioscrobbler.com/2.0/
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-5 : Calling Last.FM method: artist.getinfo
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-5 : Last.FM call parameters: {'mbid': u'23ff8908-e8b1-4ad3-a7c7-7e7dc2f6d720', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-3 : Calling Last.FM method: artist.getinfo
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-3 : Last.FM call parameters: {'mbid': u'a8806b5c-3ee0-4277-94d3-1a5427a7707c', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-11 : Calling Last.FM method: artist.getinfo
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-2 : Calling Last.FM method: artist.getinfo
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-11 : Last.FM call parameters: {'mbid': u'3d679013-6b88-4132-ab35-d5bb4a3583fc', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-8 : Calling Last.FM method: artist.getinfo
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-8 : Last.FM call parameters: {'mbid': u'77a8f9af-f966-45d0-8bb4-b0fe3b8c339b', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-2 : Last.FM call parameters: {'mbid': u'3837fbf1-195d-4d06-8864-ee67b3f10fb3', 'api_key': ‘***’, 'method': 'artist.getinfo', 'format': 'json'}
29-May-2019 07:41:18 - DEBUG   :: CP Server Thread-6 : Last.FM returned an error: Rate Limit Exceeded - This application has made too many requests in a short period. If this is your API key, see https://www.last.fm/api/tos#4.4 for information about raising the limit.```
nopoz commented 5 years ago

I've submitted a pull request that fixes this by switching artwork lookups to fanart.tv - #3214

AdeHub commented 5 years ago

If I change the API key then the only thing not working for me is Artist Image, everything else including Album image seems ok

dmrazor commented 4 years ago

Any progress on this change? Nopoz edit seems to have failed testing

AdeHub commented 4 years ago

Try the develop branch

nine13tech commented 4 years ago

Nopz has fixed this in his pull request. I am currently running his fork and everything works.

Thank You, Frank Moss Cloud Infrastructure Architect

rantanlan commented 4 years ago

just tried his fork and its fine regarding metadata, but while switching rlses i get an error...