joalla / discogs_client

Continuation of the "Official Python Client for the Discogs API"
https://python3-discogs-client.readthedocs.io
Other
310 stars 50 forks source link

Search returns non-existent release ids #130

Open rexovas opened 1 year ago

rexovas commented 1 year ago

Came across this strange issue recently. This may not be an issue with the api client, but rather discogs' api itself.

It seems the search api can sometimes return "dormant" or otherwise hidden release ids which when attempting to access any real information about them results in a 404 error.

Here's an example: https://www.discogs.com/release/6926394

As you can see the link opens up to a 404 page

This release_id was returned (along with others) from the following search:

>>> results = d.search("DOIN THE DO", type="release", artist="BETTY BOO", label="RHYTHM KING")

>>> len(results)
47

>>> for i, release in enumerate(results):
...    print(release)

1 <Release 142429 "Betty Boo - Doin' The Do">
2 <Release 95314 "Betty Boo - Doin' The Do">
3 <Release 187294 "Betty Boo - Doin' The Do">
4 <Release 166172 "Betty Boo - Doin' The Do">
...
36 <Release 6926394 "Betty Boo - Doin' The Do"> # <-- BAD BOY
...

Calling

>>> results[36].data
{'country': 'UK', 'year': '1990', 'format': ['Vinyl', '12"', '45 RPM'], 'label': ['Rhythm King Records'], 'type': 'release', 'genre': ['Electronic', 'Pop'], 'style': ['House'], 'id': 6926394, 'barcode': ['5 016026 202392'], 'user_data': {'in_wantlist': False, 'in_collection': False}, 'master_id': 0, 'master_url': None, 'uri': '/Betty-Boo-Doin-The-Do/release/6926394', 'catno': 'LEFT 39T', 'title': "Betty Boo - Doin' The Do", 'thumb': '', 'cover_image': 'https://st.discogs.com/a33995aba384fd3cd0220d23d1e16c75f59d9927/images/spacer.gif', 'resource_url': 'https://api.discogs.com/releases/6926394', 'community': {'want': 0, 'have': 0}, 'format_quantity': 1, 'formats': [{'name': 'Vinyl', 'qty': '1', 'descriptions': ['12"', '45 RPM']}]}

will strangely yield the above results

but calling the refresh method

>>> results[36].refresh()
    raise HTTPError(body['message'], status_code)
discogs_client.exceptions.HTTPError: 404: Release not found.

results in a 404

Furthermore, simply attempting to fetch the release by ID also results in a 404

>>> d.release(6926394)
    raise HTTPError(body['message'], status_code)
discogs_client.exceptions.HTTPError: 404: Release not found.

I can only assume this is some strange deleted release or otherwise invalid release which is still being returned in search results

AnssiAhola commented 1 year ago

Thanks for reporting this. I don't think there's anything we can do, as the issue seems to be on Discogs end.

I'll leave this up for now in case someone else comes across this issue.

rexovas commented 1 year ago

Chiming back in here - I was able to confirm that this issue in fact exists when using the Discogs site itself.

You can verify by searching "4FOR MONEY IT'S A MOMENT IN TIME TEMPO", which yields a single result.
When clicking on the result, it brings you to a 404 page. I will perhaps file a bug ticket with Discogs.

JOJ0 commented 1 year ago

Awesome! Thanks! Please keep us updated!