question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

latin-1' codec can't encode character '\u2026' in position 511: ordinal not in range(256)

See original GitHub issue

Question

latin-1’ codec can’t encode character ‘\u2026’ in position 511: ordinal not in range(256)

latin-1’ codec can’t encode character ‘\u2026’ in position 511: ordinal not in range(256)

see this : youtube-dl -v https://svod.ots.aceenggacademy.com/videos/stream/ace/2021/3/19/v/70209185-10b9-4c54-8e88-45b1720e5ffc/video/720p.m3u8 --add-header cookie:"gcl_au=1.1.653338779.1640195128; _ga=GA1.2.381052531.1640195129; _gid=GA1.2.2104431829.1640195129; OTS_STU=eyJvcmdJZCI6ImFjZSIsImlkIjoiN2Y2MzJkN2ItZWQ5OS00NGFjLTljZTQtZmE5ZWZiNDdkNzcyIiwiaXNSZW1vdGUiOmZhbHNlLCJzZXNzaW9uUmVzdHJpYyI6IlNJTkdMRSIsIlVBIjoiZTZmMmYwNmQzY2VjNzhhNjQyNTMxZTg1OTQzMmUyOWEiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqYWdhZGVlc2hnb3VkMDFAZ21haWwuY29tIiwic2NvcGVzIjpbIlJPTEVfU1RVREVOVCJdLCJpc3MiOiJpQ29yZSBJbm5vdmF0aW9uIFB2dCBMdGQiLCJpYXQiOjE2NDAxOTUxNzksImV4cCI6MTY0MDIzMTE3OX0.rjj85m1Vm-sR-cVtYMr0I14…XBvY2hUaW1lIjoxNjQwMjc2NTE4fSwiRGF0ZUdyZWF0ZXJUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NDAxOTU1OTR9fX1dfQ__; CloudFront-Signature=b2RAe~eo3XxuaZ2B3LP~fYWDS74vIZn4P4wLQRKYoFXTci636lcieZmINOnLkzwDazTmCxb8hDdTrbwAazr0804ErzqrPEGe7MEfaX3-g0FUa~FozFaGMd7-xdPXE5upAJctaGbCTR5KdgHwednjLT9yE~LXXVCTMeAK2N1b2HTe4Xp8Tb0jIj-vrG~F~O5~OVPOpK5HVf3kLf9od20yE0lor9AjQoVn5SopcUIDa8q9ZkjJIT863948O4dBFaVOVZstfq2tt-eODGBiEOxaTgyZYQGsjWSgolfQR-5O1V8KbV6K2dxN~7BlN0mj8Bn68y7AKAtYBi5~ihQ5c0wXOw__; CloudFront-Key-Pair-Id=APKAJW7LPU6NRWPT2XKA" --verbose [debug] System config: [] [debug] User config: [] [debug] Custom config: [] [debug] Command-line args: ['-v', 'https://svod.ots.aceenggacademy.com/videos/stream/ace/2021/3/19/v/70209185-10b9-4c54-8e88-45b1720e5ffc/video/720p.m3u8', '--add-header', 'cookie:gcl_au=1.1.653338779.1640195128; _ga=GA1.2.381052531.1640195129; _gid=GA1.2.2104431829.1640195129; OTS_STU=eyJvcmdJZCI6ImFjZSIsImlkIjoiN2Y2MzJkN2ItZWQ5OS00NGFjLTljZTQtZmE5ZWZiNDdkNzcyIiwiaXNSZW1vdGUiOmZhbHNlLCJzZXNzaW9uUmVzdHJpYyI6IlNJTkdMRSIsIlVBIjoiZTZmMmYwNmQzY2VjNzhhNjQyNTMxZTg1OTQzMmUyOWEiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqYWdhZGVlc2hnb3VkMDFAZ21haWwuY29tIiwic2NvcGVzIjpbIlJPTEVfU1RVREVOVCJdLCJpc3MiOiJpQ29yZSBJbm5vdmF0aW9uIFB2dCBMdGQiLCJpYXQiOjE2NDAxOTUxNzksImV4cCI6MTY0MDIzMTE3OX0.rjj85m1Vm-sR-cVtYMr0I14…XBvY2hUaW1lIjoxNjQwMjc2NTE4fSwiRGF0ZUdyZWF0ZXJUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NDAxOTU1OTR9fX1dfQ__; CloudFront-Signature=b2RAe~eo3XxuaZ2B3LP~fYWDS74vIZn4P4wLQRKYoFXTci636lcieZmINOnLkzwDazTmCxb8hDdTrbwAazr0804ErzqrPEGe7MEfaX3-g0FUa~FozFaGMd7-xdPXE5upAJctaGbCTR5KdgHwednjLT9yE~LXXVCTMeAK2N1b2HTe4Xp8Tb0jIj-vrG~F~O5~OVPOpK5HVf3kLf9od20yE0lor9AjQoVn5SopcUIDa8q9ZkjJIT863948O4dBFaVOVZstfq2tt-eODGBiEOxaTgyZYQGsjWSgolfQR-5O1V8KbV6K2dxN~7BlN0mj8Bn68y7AKAtYBi5~ihQ5c0wXOw__; CloudFront-Key-Pair-Id=APKAJW7LPU6NRWPT2XKA', '--verbose'] [debug] Adding header from command line option cookie:gcl_au=1.1.653338779.1640195128; _ga=GA1.2.381052531.1640195129; _gid=GA1.2.2104431829.1640195129; OTS_STU=eyJvcmdJZCI6ImFjZSIsImlkIjoiN2Y2MzJkN2ItZWQ5OS00NGFjLTljZTQtZmE5ZWZiNDdkNzcyIiwiaXNSZW1vdGUiOmZhbHNlLCJzZXNzaW9uUmVzdHJpYyI6IlNJTkdMRSIsIlVBIjoiZTZmMmYwNmQzY2VjNzhhNjQyNTMxZTg1OTQzMmUyOWEiLCJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJqYWdhZGVlc2hnb3VkMDFAZ21haWwuY29tIiwic2NvcGVzIjpbIlJPTEVfU1RVREVOVCJdLCJpc3MiOiJpQ29yZSBJbm5vdmF0aW9uIFB2dCBMdGQiLCJpYXQiOjE2NDAxOTUxNzksImV4cCI6MTY0MDIzMTE3OX0.rjj85m1Vm-sR-cVtYMr0I14…XBvY2hUaW1lIjoxNjQwMjc2NTE4fSwiRGF0ZUdyZWF0ZXJUaGFuIjp7IkFXUzpFcG9jaFRpbWUiOjE2NDAxOTU1OTR9fX1dfQ__; CloudFront-Signature=b2RAe~eo3XxuaZ2B3LP~fYWDS74vIZn4P4wLQRKYoFXTci636lcieZmINOnLkzwDazTmCxb8hDdTrbwAazr0804ErzqrPEGe7MEfaX3-g0FUa~FozFaGMd7-xdPXE5upAJctaGbCTR5KdgHwednjLT9yE~LXXVCTMeAK2N1b2HTe4Xp8Tb0jIj-vrG~F~O5~OVPOpK5HVf3kLf9od20yE0lor9AjQoVn5SopcUIDa8q9ZkjJIT863948O4dBFaVOVZstfq2tt-eODGBiEOxaTgyZYQGsjWSgolfQR-5O1V8KbV6K2dxN~7BlN0mj8Bn68y7AKAtYBi5~ihQ5c0wXOw__; CloudFront-Key-Pair-Id=APKAJW7LPU6NRWPT2XKA [debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8 [debug] youtube-dl version 2020.03.24 [debug] Python version 3.8.10 (CPython) - Linux-5.11.0-43-generic-x86_64-with-glibc2.29 [debug] exe versions: ffmpeg 4.2.4, ffprobe 4.2.4, rtmpdump 2.4 [debug] Proxy map: {} [generic] 720p: Requesting header Traceback (most recent call last): File "/usr/bin/youtube-dl", line 11, in <module> load_entry_point('youtube-dl==2020.3.24', 'console_scripts', 'youtube-dl')() File "/usr/lib/python3/dist-packages/youtube_dl/__init__.py", line 478, in main _real_main(argv) File "/usr/lib/python3/dist-packages/youtube_dl/__init__.py", line 468, in _real_main retcode = ydl.download(all_urls) File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 2018, in download res = self.extract_info( File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 797, in extract_info ie_result = ie.extract(url) File "/usr/lib/python3/dist-packages/youtube_dl/extractor/common.py", line 530, in extract ie_result = self._real_extract(url) File "/usr/lib/python3/dist-packages/youtube_dl/extractor/generic.py", line 2283, in _real_extract head_response = self._request_webpage( File "/usr/lib/python3/dist-packages/youtube_dl/extractor/common.py", line 627, in _request_webpage return self._downloader.urlopen(url_or_request) File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 2238, in urlopen return self._opener.open(req, timeout=self._socket_timeout) File "/usr/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain result = func(*args) File "/usr/lib/python3/dist-packages/youtube_dl/utils.py", line 2726, in https_open return self.do_open(functools.partial( File "/usr/lib/python3.8/urllib/request.py", line 1354, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/lib/python3.8/http/client.py", line 1256, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1297, in _send_request self.putheader(hdr, value) File "/usr/lib/python3.8/http/client.py", line 1229, in putheader values[i] = one_value.encode('latin-1') UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' in position 511: ordinal not in range(256)

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ghostcommented, Dec 23, 2021
  • Right click on the request line and look for Copy as cURL or Copy Request Headers menu or alike, then pick up the cookie.
  • Use browser extension to export cookies to a file, and use the --cookies option. How do I pass cookies to youtube-dl?
0reactions
ghostcommented, Dec 24, 2021

What would happen if you add --hls-prefer-native option to youtube-dl?

There is an error:

[hls @ 0x55f50879de00] Unable to open key file https://ots.aceenggacademy.com/vod/svideo/k/70209185-10b9-4c54-8e88-45b1720e5ffc/enc2.key

You need to find out how to get around this error.

Read more comments on GitHub >

github_iconTop Results From Across the Web

UnicodeEncodeError: 'latin-1' codec can't encode character
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2013' in position 106: ordinal not in range(256). Solution 1: \u2013 - google ...
Read more >
'latin-1' codec can't encode character '\u2026' · Issue #375 ...
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2026' #375 ... can't encode character '\u2026' in position 574161: ordinal not in range(256).
Read more >
Server Error UnicodeEncodeError: 'latin-1' codec can't encode ...
Server Error UnicodeEncodeError: 'latin-1' codec can't encode characters in position 54-59: ordinal not in range(256).
Read more >
'latin-1' codec can't encode character 'u2026' in position 512 ...
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2013' in position 83: ordinal not in range(256) ; 2. UnicodeEncodeError ; 4. 'He said \x93Hello\x94'.
Read more >
Can't save files ('latin-1' codec can't encode character '\u0131 ...
I'm re-tagging my library atm and I get this error a lot lately. Not in a flac or ogg file, always in a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found