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.19k stars 163 forks source link

UnicodeEncodeError: 'charmap' codec can't encode characters in position 63-65: character maps to <undefined> 'ab_channel' is not recognized as an internal or external command #166

Closed eitroo closed 3 years ago

eitroo commented 3 years ago

Bug report

I ran: ytmdl https://www.youtube.com/watch?v=JWqmJh7JNS4&ab_channel=DOVA-SYNDROMEYouTubeOfficial

Version Info

How Ytmdl was installed?

python setuptools

Console Log

Traceback (most recent call last):
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\Scripts\ytmdl", line 4, in <module>
    __import__('pkg_resources').run_script('ytmdl==2021.1.14', 'ytmdl')
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 658, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 1445, in run_script
    exec(script_code, namespace, namespace)
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 456, in <module>
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 451, in extract_data
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 234, in main
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\ytmdl\core.py", line 109, in download
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\logger.py", line 338, in info
    self._write(message, args, LEVEL_NUMBER)
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\logger.py", line 198, in _write
    self.name
  File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\stream.py", line 134, in write
    print(_formatted_out, **params)
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\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 63-65: character maps to <undefined>
'ab_channel' is not recognized as an internal or external command,
operable program or batch file.
deepjyoti30 commented 3 years ago

@eitroo Can you share the version of Python installed in your machine.

You can do the following:

python --version # For 2.x
python3 --version # For 3.x
eitroo commented 3 years ago

python: Python 3.6.7

deepjyoti30 commented 3 years ago

@eitroo I think I missed this when I initially looked at your example but in it you have passed the URL https://www.youtube.com/watch?v=JWqmJh7JNS4&ab_channel=DOVA-SYNDROMEYouTubeOfficial which also contains the ab_channel flag. I think that's why the error appeared.

You can just pass the above URL in the following way and it will totally work:

ytmdl https://www.youtube.com/watch?v=JWqmJh7JNS4
eitroo commented 3 years ago

Still doesn't work. Here the result: PS C:\Users\aech\Music> ytmdl https://www.youtube.com/watch?v=JWqmJh7JNS4 ==> Searching to see if already present in C:\Users\aech\Music ==> Searching Youtube for https://www.youtube.com/watch?v=JWqmJh7JNS4 ==> Choose One (One with [M] is verified music) [1] Mercury Lamp @ フリーBGM DOVA-SYNDROME OFFICIAL YouTube CHANNEL by DOVA-SYNDROME YouTube Official with dur 02:42 [2] Amelia Watson: "Bubba's 3D Debut!" by HoloLiveEN Highlights with dur 01:51 [3] Amelia Watson 3D Dancing Bubba Outro (1 Hour Loop) by Mighty Eggroll with dur 01:00:10 [4] Baked Scallion with Cheese ~Japanese BBQ flavor~ / 長ねぎマヨチーズ焼き by MinaCanCooking Channel with dur 01:24 [5] 【HoloEN】Ame's 1 Million Mini Celebration by Hololive Boubon with dur 03:09 [0] More results ==> Enter Choice (1): ==> Downloading Mercury Lamp @ フリーBGM DOVA-SYNDROME OFFICIAL YouTube CHANNEL in 320kbps Traceback (most recent call last): File "D:\Users\aech\AppData\Local\Programs\Python\Python36\Scripts\ytmdl", line 4, in <module> __import__('pkg_resources').run_script('ytmdl==2021.1.14', 'ytmdl') File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 658, in run_script self.require(requires)[0].run_script(script_name, ns) File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\pkg_resources\__init__.py", line 1445, in run_script exec(script_code, namespace, namespace) File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 456, in <module> File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 451, in extract_data File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\EGG-INFO\scripts\ytmdl", line 234, in main File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\ytmdl-2021.1.14-py3.6.egg\ytmdl\core.py", line 109, in download File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\logger.py", line 338, in info self._write(message, args, LEVEL_NUMBER) File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\logger.py", line 198, in _write self.name File "d:\users\aech\appdata\local\programs\python\python36\lib\site-packages\simber\stream.py", line 134, in write print(_formatted_out, **params) File "D:\Users\aech\AppData\Local\Programs\Python\Python36\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 63-65: character maps to <undefined>

deepjyoti30 commented 3 years ago

@eitroo I just tried this on the latest release and it worked all right.

Can you try upgrading to the latest release and upgrade youtube-dl as well. That should fix it I guess. Also please post the logs using multiline code block instead of single line.

eitroo commented 3 years ago

@deepjyoti30 I've upgraded with: pip install ytmdl --upgrade Successfully installed ytmdl-2021.3.4

However, same error:

 File "D:\Users\aech\AppData\Local\Programs\Python\Python36\Scripts\ytmdl", line 478, in <module>
    extract_data()
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\Scripts\ytmdl", line 473, in extract_data
    main(args)
 File "D:\Users\aech\AppData\Local\Programs\Python\Python36\Scripts\ytmdl", line 245, in main
    path = download(link, yt_title, args)
 File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\ytmdl\core.py", line 115, in download
    Style.RESET_ALL
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\simber\logger.py", line 338, in info
    self._write(message, args, LEVEL_NUMBER)
  File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\simber\logger.py", line 198, in _write
    self.name
 File "D:\Users\aech\AppData\Local\Programs\Python\Python36\lib\site-packages\simber\stream.py", line 134, in write
    print(_formatted_out, **params)
 File "D:\Users\aech\AppData\Local\Programs\Python\Python36\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 63-65: character maps to <undefined>
deepjyoti30 commented 3 years ago

@eitroo Thanks for the log. It seems like it is a simber issue. Can you share the version of simber you're using? Use the following command:

pip freeze | grep -i simber
deepjyoti30 commented 3 years ago

@eitroo Also, is this happening with all songs that you're trying to download or just this one in particular and others are working all right?

eitroo commented 3 years ago

It appears it's just this one song. This one worked at least https://www.youtube.com/watch?v=x4llqoD2kq8. Tried with this one https://www.youtube.com/watch?v=INZ1IWYOhYU, but didn't work with the same error: UnicodeEncodeError: 'charmap' codec can't encode characters in position 56-58: character maps to <undefined> It appears any titles including anything but latin letters has errors.

eitroo commented 3 years ago

@deepjyoti30 simber 0.2.1

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs for another 7 days. Thank you for your contributions.