deepjyoti30 / ytmdl

A simple app to get songs from YouTube in mp3 format with artist name, album name etc from sources like iTunes, Spotify, LastFM, Deezer, Gaana etc.
https://ytmdl.deepjyoti30.dev
MIT License
3.2k stars 164 forks source link

Unicode Error on download. #240

Closed aqilc closed 1 year ago

aqilc commented 2 years ago

Bug report

Checklist

Version Info

How Ytmdl was installed?

pip install ytmdl
pip install simber downloader-cli --upgrade

Console Log

d:\music\kpop\info>ytmdl https://music.youtube.com/playlist?list=PLCd48b9AA1uwJRhoCW-5vbXTiNXm-SAYJ --format mp3
 ==> Youtube playlist passed...extracting!
 ==> Playlist: kpop-p
 ==> 127 songs found
 ==> Searching to see if already present in C:\Users\aqilc\Music
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\Scripts\ytmdl.exe\__main__.py", line 7, in <module>
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ytmdl\main.py", line 582, in entry
    extract_data()
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ytmdl\main.py", line 575, in extract_data
    main(args)
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ytmdl\main.py", line 282, in main
    path = download(link, yt_title, args)
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\ytmdl\core.py", line 109, in download
    logger.info('Downloading {}{}{} in {}{}kbps{}'.format(
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\simber\logger.py", line 366, in info
    self._write(message, args, LEVEL_NUMBER)
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\simber\logger.py", line 203, in _write
    stream.write(
  File "C:\Users\aqilc\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.9_qbz5n2kfra8p0\LocalCache\local-packages\Python39\site-packages\simber\stream.py", line 138, in write
    print(_formatted_out, **params)
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.9_3.9.3568.0_x64__qbz5n2kfra8p0\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode characters in position 53-55: character maps to <undefined>

Description

This was my first time using the downloader, I'm on Windows 10 21H2 and IDK this was the first thing that happened.

deepjyoti30 commented 2 years ago

@AqilCont Can you share the version of simber installed in your system? You can find that by doing a pip freeze and checking the simber line in there.

You can use grep but on Windows I am not sure if it would be supported else above can be done simply using pip freeze | grep -i simber.

orkeilius commented 2 years ago

i have a similar issue and my simber version is 0.2.4

orkeilius commented 2 years ago

After investigation, it seems that title/metadata with special characters like this character "【" in this video make this bug.

If you use the "--disable-file" argument that "fix" the bug but make another error when creating the file (no such file or directory) (similar to #236 )

deepjyoti30 commented 2 years ago

@orkeilius Thanks for investigating. This issue is related to simber. However, the video you shared and the issue you are getting is probably because of the charcter ~ in the video.

I think we are not removing it before creating the song file right now.

deepjyoti30 commented 1 year ago

A new release of simber is now published that should fix the above issue. I am closing this issue for now. In case this happens again, I can reopen this issue.