snejus / beetcamp

Bandcamp autotagger source for beets (https://beets.io)
GNU General Public License v2.0
68 stars 12 forks source link

Doesn't seem to be able to fetch from Bandcamp anymore? #64

Closed eramdam closed 4 months ago

eramdam commented 4 months ago

Example with a given URL:

> beetcamp https://carbonbasedlifeforms.bandcamp.com/album/seeker
bandcamp: URL Not found: https://carbonbasedlifeforms.bandcamp.com/album/seeker
bandcamp: URL Not found: https://carbonbasedlifeforms.bandcamp.com/album/seeker
bandcamp: Failed obtaining https://carbonbasedlifeforms.bandcamp.com/album/seeker
bandcamp: URL Not found: https://carbonbasedlifeforms.bandcamp.com/album/seeker
bandcamp: Failed obtaining https://carbonbasedlifeforms.bandcamp.com/album/seeker
Traceback (most recent call last):
  File "/Users/damien/.local/bin/beetcamp", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/damien/Library/Application Support/pipx/venvs/beetcamp/lib/python3.12/site-packages/beetsplug/bandcamp/__init__.py", line 399, in main
    raise AssertionError("Failed to find a release under the given url")
AssertionError: Failed to find a release under the given url

Example with an album search:

> beetcamp -a "smooth mcgroove"
Traceback (most recent call last):
  File "/Users/damien/.local/bin/beetcamp", line 10, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/damien/Library/Application Support/pipx/venvs/beetcamp/lib/python3.12/site-packages/beetsplug/bandcamp/__init__.py", line 379, in main
    search_results = search_bandcamp(**search_vars)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/damien/Library/Application Support/pipx/venvs/beetcamp/lib/python3.12/site-packages/beetsplug/bandcamp/search.py", line 115, in search_bandcamp
    return parse_and_sort_results(get(url), **kwargs)
                                  ^^^^^^^^
  File "/Users/damien/Library/Application Support/pipx/venvs/beetcamp/lib/python3.12/site-packages/beetsplug/bandcamp/search.py", line 99, in get_url
    response.raise_for_status()
  File "/Users/damien/Library/Application Support/pipx/venvs/beetcamp/lib/python3.12/site-packages/requests/models.py", line 1024, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://bandcamp.com/search?page=1&q=smooth%20mcgroove&item_type=a
eramdam commented 4 months ago

I tried on a Linux (Debian 12) VM and it seems to work fine with Python 3.11.. I can't easily downgrade to Python 3.11 on macOS so maybe it's related? 😓

EDIT: Tried a Debian 13 VM with Python 3.12 and it's working so something in my setup must be messed up on macOS...

snejus commented 4 months ago

Thanks for reporting this @eramdam. @ThinkChaos has fixed this issue and the package has now been updated on pypi :)

ThinkChaos commented 4 months ago

I hope it fixes it, but there might be other things that trigger 403s for others. Only experience will tell!

eramdam commented 4 months ago

Hell yeah, that seems to work, thanks!