Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

soundcloud soundscrape no longer working (401 unauthorized) #261

Open
g-mac opened this issue Aug 13, 2021 · 9 comments
Open

soundcloud soundscrape no longer working (401 unauthorized) #261

g-mac opened this issue Aug 13, 2021 · 9 comments

Comments

@g-mac
Copy link

g-mac commented Aug 13, 2021

Hey, it seems to me like soundscraping soundcloud is no longer working. Following the issue throughout the code its seems that a 401 http error, unauthorized is the issue, which is the response received in line 526 [get_hard_track_url()].
Does this have something todo with the new security update from soundcloud? https://developers.soundcloud.com/blog/security-updates-api

would be super happy if a fix for this issue was found.

best wishes,
simon

macbook:3.6 simon$ soundscrape https://soundcloud.com/afterhour-sounds/premiere-ele-bisu-app_version=1481046241
Scraping: Stream PREMIERE: ele & bisu - Cardamom Coffee [ Talpa Rec. ]
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 188, in process_soundcloud
    resolved = client.get('/resolve', url=artist_url, limit=200)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundcloud/client.py", line 133, in _request
    return wrapped_resource(make_request(method, url, kwargs))
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundcloud/request.py", line 148, in make_request
    result.raise_for_status()
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 940, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.soundcloud.com/tracks/1021056175

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.6/bin/soundscrape", line 8, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 123, in main
    process_soundcloud(vargs)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 222, in process_soundcloud
    filename = download_file(hard_track_url, filename)
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/soundscrape/soundscrape.py", line 1227, in download_file
    if url[0:2] == '//':
TypeError: 'NoneType' object is not subscriptable
@g-mac
Copy link
Author

g-mac commented Aug 26, 2021

@Miserlou is this the end of it? the end of soundscrape for soundcloud? i cannot get my head around it, but it looks like they ve changed a bunch of things and upped their security.. what do you think? fixable? hackable?

@Yozakamw
Copy link

Seriously tho i just wanted to get all my songs on my phone this was my go to for a very long time, i hope this gets fixed soon.

@g-mac
Copy link
Author

g-mac commented Oct 13, 2021

right, thanks for the input - i ended up using a different tool for soundcloud downloads for now.
However I would enjoy if soundscrape was fixed - and the broken link was really not the problem, the 401 unauthorized is real.

@kr-ish
Copy link

kr-ish commented Oct 16, 2021

right, thanks for the input - i ended up using a different tool for soundcloud downloads for now. However I would enjoy if soundscrape was fixed - and the broken link was really not the problem, the 401 unauthorized is real.

@g-mac which tool did you use? thank you !

@hbak
Copy link

hbak commented Oct 20, 2021

https://github.com/ytdl-org/youtube-dl

youtube-dl --add-metadata --embed-thumbnail [soundcloud url] seems to do the trick (with caveats).

  • you need ffmpeg installed for it to be able to edit metadata
  • attempting to add both metadata and embed the thumbnail at the same time results in a permission error, I work around by running the command a second time

edit: I haven't been getting the permission error. Also, I don't like when it ends up downloading a .wav file. Youtube-dl will convert the wav to mp3 and then apply the metadata + thumbnail for you if you use the following command:
youtube-dl --no-mtime --add-metadata --embed-thumbnail -x --audio-format mp3 --audio-quality 2 [soundcloud url]

See the github page for how --audio-quality works. Note that if what you download is already an mp3, then it won't attempt to convert it and apply the audio-quality setting. So basically, always use the newer command with audio-format and audio-quality, and it will convert a wav for you if that's what you pull, but do nothing different otherwise.

@bsans
Copy link

bsans commented Nov 5, 2021

youtube-dl and incantation posted by @hbak works for me (no permission error). I installed youtube-dl via brew and it installed ffmpeg as part of that. Thanks for the tip!
The Soundcloud api changes are ostensibly so "we can relaunch API access to all developers", which might be a good thing in the end.

@IanRock542
Copy link

Why isn't youtube-dl running into the same error as Soundscrape?

@7k50
Copy link

7k50 commented Dec 11, 2021

https://github.com/flyingrub/scdl works for Soundcloud

@KonstantinGolub
Copy link

KonstantinGolub commented Mar 4, 2024

youtube-dl --add-metadata --embed-thumbnail

how to select audio quality? mp3 320 or 192 or any other?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants