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

TypeError: can only concatenate str (not "NoneType") to str #453

Open
awsms opened this issue Jul 16, 2023 · 1 comment
Open

TypeError: can only concatenate str (not "NoneType") to str #453

awsms opened this issue Jul 16, 2023 · 1 comment

Comments

@awsms
Copy link

awsms commented Jul 16, 2023

Traceback (most recent call last):
  File "/home/me/.local/bin/scdl", line 8, in <module>
    sys.exit(main())
  File "/home/me/.local/lib/python3.8/site-packages/scdl/scdl.py", line 239, in main
    download_url(client, **python_args)
  File "/home/me/.local/lib/python3.8/site-packages/scdl/scdl.py", line 344, in download_url
    download_track(client, track, exit_on_fail=kwargs.get("strict_playlist"), **kwargs)
  File "/home/me/.local/lib/python3.8/site-packages/scdl/scdl.py", line 712, in download_track
    filename, is_already_downloaded = download_original_file(client, track, title, playlist_info, **kwargs)
  File "/home/me/.local/lib/python3.8/site-packages/scdl/scdl.py", line 567, in download_original_file
    filename += ext
TypeError: can only concatenate str (not "NoneType") to str

always getting this error on https://soundcloud.com/stanlepard/kurplaxin-by-vibramax

@max-ishere
Copy link

max-ishere commented Oct 11, 2023

It seems the track doesnt have an extension and soundcloud didnt label it with Content-Type: (mime type). So the propper solution would probably be to implement functionality like unix file command:

$ file Kurplaxin\ by\ Vibramax.unknown 
Kurplaxin by Vibramax.unknown: RIFF (little-endian) data, WAVE audio

As a temporary solution you can open the location of the script and add the following before line 633:

=        # Find file extension
=        mime = r.headers.get("content-type")
=        ext = ext or mimetypes.guess_extension(mime)
+
+        if ext == "" or ext == None:
+            ext = ".unknown"
+
=        filename += ext

ext here is the file extension.

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

2 participants