Miserlou / SoundScrape

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

AttributeError: 'HTTPError' object has no attribute 'replace' #220

Closed hitsfromdabong closed 4 years ago

hitsfromdabong commented 5 years ago

Running soundscrape https://soundcloud.com/twsounds/paula-temple-live-at-time-warp-2018 results in:

Downloading: Paula Temple live at Time Warp Mannheim 2018
Problem downloading Paula Temple live at Time Warp Mannheim 2018
Traceback (most recent call last):
  File "/usr/local/bin/soundscrape", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 119, in main
    process_soundcloud(vargs)
  File "/usr/local/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 292, in process_soundcloud
    id3_extras=id3_extras)
  File "/usr/local/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 460, in download_tracks
    puts_safe(e)
  File "/usr/local/lib/python2.7/site-packages/soundscrape/soundscrape.py", line 1315, in puts_safe
    puts(text)
  File "/usr/local/lib/python2.7/site-packages/clint/textui/core.py", line 57, in puts
    s = tsplit(s, NEWLINES)
  File "/usr/local/lib/python2.7/site-packages/clint/utils.py", line 69, in tsplit
    string = string.replace(i, final_delimiter)
AttributeError: 'HTTPError' object has no attribute 'replace'

This is a problem with urllib. soundscrape was installed with brew and ran under python v 2.7.

Running with python v 3 fixes the problem.

Quick fix:

git clone https://github.com/Miserlou/SoundScrape
cd SoundScrape
while read p; do; pip3 install $p; done < requirements.txt
[OR: pip3 install -r requirements.txt]
cd soundscrape
python3 soundscrape [...]
iam-mhaseeb commented 5 years ago

Getting same error I installed with pip install soundscrape in venv which contains python3. Technically it should work?

christopherjmedlin commented 5 years ago

I also happened to get this error when I was trying to scrape something really long (>1 hour). Don't see how that error could be linked to length, but maybe it is.

iam-mhaseeb commented 5 years ago

@christopherjmedlin I followed above mentioned steps and it worked for me.

Lanchon commented 5 years ago

another example of this issue:

$ soundscrape https://soundcloud.com/anjunadeep/the-anjunadeep-edition-241
Downloading: The Anjunadeep Edition 241 with Braxton
Problem downloading The Anjunadeep Edition 241 with Braxton
Traceback (most recent call last):
  File "/usr/local/bin/soundscrape", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python2.7/dist-packages/soundscrape/soundscrape.py", line 119, in main
    process_soundcloud(vargs)
  File "/usr/local/lib/python2.7/dist-packages/soundscrape/soundscrape.py", line 292, in process_soundcloud
    id3_extras=id3_extras)
  File "/usr/local/lib/python2.7/dist-packages/soundscrape/soundscrape.py", line 460, in download_tracks
    puts_safe(e)
  File "/usr/local/lib/python2.7/dist-packages/soundscrape/soundscrape.py", line 1315, in puts_safe
    puts(text)
  File "/usr/local/lib/python2.7/dist-packages/clint/textui/core.py", line 57, in puts
    s = tsplit(s, NEWLINES)
  File "/usr/local/lib/python2.7/dist-packages/clint/utils.py", line 69, in tsplit
    string = string.replace(i, final_delimiter)
AttributeError: 'HTTPError' object has no attribute 'replace'
SimplicityGuy commented 4 years ago

PR #241 handles http errors more gracefully.