spaam / svtplay-dl

Small command-line program to download videos from some streaming sites.
https://svtplay-dl.se
MIT License
724 stars 122 forks source link

UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 6: ordinal not in range(128) #716

Closed Sopor closed 7 years ago

Sopor commented 7 years ago

I get this when i try to download with svtplay-dl 1.9.6-21-g59d2513

$ svtplay-dl -A -S -P hls --verbose https://www.tv4play.se/program/unga-f%C3%B6r%C3%A4ldrar
DEBUG [1507677849.68] /usr/local/bin/svtplay-dl/svtplay_dl/utils/__init__.py/request: HTTP getting 'http://webapi.tv4play.se/play/video_assets?type=episode&is_live=false&platform=web&node_nids=unga-f%C3%B6r%C3%A4ldrar&per_page=99999'
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/bin/svtplay-dl/__main__.py", line 13, in <module>
  File "/usr/local/bin/svtplay-dl/svtplay_dl/__init__.py", line 479, in main
  File "/usr/local/bin/svtplay-dl/svtplay_dl/__init__.py", line 199, in get_media
  File "/usr/local/bin/svtplay-dl/svtplay_dl/__init__.py", line 215, in get_all_episodes
  File "/usr/local/bin/svtplay-dl/svtplay_dl/service/tv4play.py", line 222, in find_all_episodes
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 6: ordinal not in range(128)
dalgr commented 7 years ago

Need to convert ascii string to Unicode, this problem can also arise for other services.

b0bber commented 7 years ago

I'm getting the same issue with TV4 Play when using 1.9.6-25-g9f1c01a

svtplay-dl --verbose https://www.tv4play.se/program/bachelor-n%C3%A4r-leken-blev-allvar/3937491 DEBUG [1508341324.41] /usr/local/bin/svtplay-dl/svtplay_dl/utils/init.py/request: HTTP getting 'https://www.tv4play.se/program/bachelor-n%C3%A4r-leken-blev-allvar/3937491' DEBUG [1508341324.54] /usr/local/bin/svtplay-dl/svtplay_dl/utils/init.py/request: HTTP getting 'http://prima.tv4play.se/api/web/asset/3937491/play' DEBUG [1508341324.69] /usr/local/bin/svtplay-dl/svtplay_dl/utils/init.py/request: HTTP getting 'http://webapi.tv4play.se/play/video_assets?type=episode&is_live=false&platform=web&node_nids=bachelor-n%C3%A4r-leken-blev-allvar&per_page=99999' ERROR [1508341324.75] /usr/local/bin/svtplay-dl/svtplay_dl/init.py/get_one_media: version: 1.9.6-25-g9f1c01a Traceback (most recent call last): File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "main", fname, loader, pkg_name) File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals File "/usr/local/bin/svtplay-dl/main.py", line 13, in File "/usr/local/bin/svtplay-dl/svtplay_dl/init.py", line 479, in main File "/usr/local/bin/svtplay-dl/svtplay_dl/init.py", line 201, in get_media File "/usr/local/bin/svtplay-dl/svtplay_dl/init.py", line 249, in get_one_media File "/usr/local/bin/svtplay-dl/svtplay_dl/service/tv4play.py", line 71, in get File "/usr/local/bin/svtplay-dl/svtplay_dl/service/tv4play.py", line 186, in _autoname UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 12: ordinal not in range(128)

Sopor commented 7 years ago

Yes, it doesn't seems to be fixed yet :(

tobiasger commented 5 years ago

I'm getting a similiar error that seems to happen when using the --merge-subtitle or -S flags. Using the latest 2.1 version. I get the same errors for SVT Play and Dplay.

Traceback (most recent call last):
  File "/usr/bin/svtplay-dl", line 7, in <module>
    svtplay_dl.main()
  File "/usr/lib/python3/dist-packages/svtplay_dl/__init__.py", line 64, in main
    get_media(urls[0], config, __version__)
  File "/usr/lib/python3/dist-packages/svtplay_dl/utils/getmedia.py", line 56, in get_media
    get_all_episodes(stream, url)
  File "/usr/lib/python3/dist-packages/svtplay_dl/utils/getmedia.py", line 87, in get_all_episodes
    get_one_media(substream)
  File "/usr/lib/python3/dist-packages/svtplay_dl/utils/getmedia.py", line 176, in get_one_media
    options_subs_dl(subfixes)
  File "/usr/lib/python3/dist-packages/svtplay_dl/utils/getmedia.py", line 171, in options_subs_dl
    subs[0].download()
  File "/usr/lib/python3/dist-packages/svtplay_dl/subtitle/__init__.py", line 73, in download
    self.save_file(data, "srt")
  File "/usr/lib/python3/dist-packages/svtplay_dl/subtitle/__init__.py", line 82, in save_file
    file_d.write(data)
UnicodeEncodeError: 'ascii' codec can't encode character '\xf6' in position 51: ordinal not in range(128)

Edit: Seems like this was an issue when running it through SSH from my Mac to my Raspberry Pi. Doing the command in the Pi itself worked without any errors.