couldbejake / spotify2mp3

Simple free and unlimited Spotify playlist downloads. Spotify2mp3 - Spotify Downloader
MIT License
270 stars 42 forks source link

[Bug] I'm trying to use the script but facing bugs #8

Closed saiftheboss7 closed 2 years ago

saiftheboss7 commented 2 years ago

I was trying to use the script to download a playlist and have configured everything.

CleanShot 2022-05-21 at 13 17 33@2x

I think the view count is being generated in UTF-8 unicode format (in this case: Bengali) from the localized version of Spotify website. The script is not being able to handle it.

Here's the error

Traceback (most recent call last): File "/Users/saif/Downloads/spotify2mp3/run.py", line 268, in <module> main() File "/Users/saif/Downloads/spotify2mp3/run.py", line 262, in main download_playlist(spotify_url_link, playlist_name) File "/Users/saif/Downloads/spotify2mp3/run.py", line 164, in download_playlist song_viewcount = int(yt_data['views'].split(' ')[0].replace(',', '')) ValueError: invalid literal for int() with base 10: '16992104টি'

saiftheboss7 commented 2 years ago

@couldbejake It'd be great if you could take a look at it. I'd be happy to provide any more details that might help you :D

TheLeank commented 2 years ago

Andm in some countries the number separator is the "." character and not the ",", giving the same error but for different reasons. In my case I just had to change the 164 line number separator to a dot.

saiftheboss7 commented 2 years ago

@TheLeank I tried your fix but unfortunately I still get the same error. Because my views count is a string with a Bangla word "টি" with it

TheLeank commented 2 years ago

@TheLeank I tried your fix but unfortunately I still get the same error. Because my views count is a string with a Bangla word "টি" with it

Yeah, is not the very same bug. But you still can hardcode the view count and avoid the error. Just replace the line 164 of the file to:

song_viewcount = 9999

By default, the script won't download a song with less than 5000 YouTube views, since this app doesn't really download the song from Spotify: it retrieves the song names from a Spotify playlist, then searches and download them from YouTube.

With that patch, you'll be able to download every song in your playlist.

couldbejake commented 2 years ago

The script has been patched for different locales, if this fix does not work or you find another bug, feel free to report it via the issues tab.

Have a nice day :)