Miserlou / SoundScrape

SoundCloud (and Bandcamp and Mixcloud) downloader in Python.
MIT License
1.42k stars 145 forks source link

error in demjson setup command: use_2to3 is invalid #272

Open ryanbuckleyca opened 7 months ago

ryanbuckleyca commented 7 months ago

i tried pip install soundscrape demjson==2.2.3 too but it didn't work.

➜  ~ pip install soundscrape
Collecting soundscrape
  Downloading soundscrape-0.31.0-py3-none-any.whl (16 kB)
Collecting args>=0.1.0 (from soundscrape)
  Downloading args-0.1.0.tar.gz (3.0 kB)
  Preparing metadata (setup.py) ... done
Collecting clint>=0.3.2 (from soundscrape)
  Downloading clint-0.5.1.tar.gz (29 kB)
  Preparing metadata (setup.py) ... done
Collecting demjson>=2.2.2 (from soundscrape)
  Downloading demjson-2.2.4.tar.gz (131 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 131.5/131.5 kB 2.1 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in demjson setup command: use_2to3 is invalid.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
soulwax commented 6 months ago

My original comment was:

Using miniconda3, after installation:

  1. conda init
  2. conda create --name <name_your_env> python=3.9
  3. conda activate <name_your_env>
  4. pip install "setuptools<58.0.0"
  5. pip install soundscrape Edit, turns out step 6 was also required for me:
  6. pip install six

Then: soundscrape --help should work.

soundscrape --help works fine then, but even if I use their own examples: soundscrape rabbit-i-am -n 3 - there's errors.

The issue I encounter now was shared here. I believe currenctly the issues run deeper than just versions or dependencies. Pure conjecture: Scraping music off of soundcloud has become more obfuscated and this repo/package did not "go with the times".

A selenium approach may be of necessity now.

ryanbuckleyca commented 6 months ago

I eventually got it to work with installing python 3.9, installing "setuptools<58.0.0" and then running pip install soundscrape demjson==2.2.3 again.

now i'm noticing the Client ID is likely out of date:

Traceback (most recent call last):
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundscrape/soundscrape.py", line 188, in process_soundcloud
    resolved = client.get('/resolve', url=artist_url, limit=200)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundcloud/client.py", line 133, in _request
    return wrapped_resource(make_request(method, url, kwargs))
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundcloud/request.py", line 148, in make_request
    result.raise_for_status()
  File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1021, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.soundcloud.com/resolve?url=https%3A%2F%2Fsoundcloud.com%2Fperlair%2Fbaby1&limit=200&client_id=a3dd183a357fcff9a6943c0d65664087

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/ry/Library/Python/3.11/bin/soundscrape", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundscrape/soundscrape.py", line 123, in main
    process_soundcloud(vargs)
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundscrape/soundscrape.py", line 222, in process_soundcloud
    filename = download_file(hard_track_url, filename)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/ry/Library/Python/3.11/lib/python/site-packages/soundscrape/soundscrape.py", line 1224, in download_file
    if url[0:2] == '//':
       ~~~^^^^^
TypeError: 'NoneType' object is not subscriptable

seems related to: https://github.com/Miserlou/SoundScrape/issues/261

soulwax commented 6 months ago

I confirm what the guy above me said.

Did you also have to do step 6 - pip install six as it was for me?