youtube-dl: dplay.py several bugs latin1' codec can't encode and other bug errors about requests.py, client.py, common.py
Checklist
- I’m reporting a broken site support issue
- I’ve verified that I’m running youtube-dl version 2021.12.17
- I’ve checked that all provided URLs are alive and playable in a browser
- I’ve checked that all URLs and arguments with special characters are properly quoted or escaped
- I’ve searched the bugtracker for similar bug reports including closed ones
- I’ve read bugs section in FAQ
Verbose log
Microsoft Windows [Versione 10.0.19043.2006]
(c) Microsoft Corporation. Tutti i diritti sono riservati.
C:\ytdl>youtube-dl.exe -v --add-header "Cookie:ass=5492a7cc-e738-41de-a74e-c3e2d46a41cb.1664712738.1664708916; OptanonAlertBoxClosed=2022-10-02T07:05:47.480Z; eupubconsent-v2=CPgPCqcPgPCqcAcABBENCjCsAP_AAH_AACiQJBNf_X__b2_j-_5_f_t0eY1P9_7__-0zjhfdl-8N3f_X_L8X52M7vF36tq4KuR4Eu3LBIUdlHOHcTUmw6okVryOsbk2cr7NKJ7PEmnMbOydYGH9_n1_z-ZKY7__vf_7zvneAA75iAGAEAIASQggAgAAABAIAAAOABAAAABIAAAAAgAgAAAAAAAAAAAAAAP3_798EggCTDVuIAuxLHAm2jCKBECMKwkOoFABRQDC0QGEDq4KdlcBPrCBAAgFAEYEQIcQUYMAgAAAgCQiICQI8EAiAIgEAAIAFQiEABGwCCgAsDAIABQDQsUYoAhAkIMiAiKUwICAAAoBACAAAAAAEQAAAAAAAgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEqFaAA.f_gAD_gAAAAA; OptanonConsent=isIABGlobal=false&datestamp=Mon+Oct+03+2022+18:07:15+GMT+0200+(Ora+legale+dell’Europa+centrale)&version=6.20.0&hosts=&consentId=4bccc028-2368-4b86-a337-24e3495a551f&interactionCount=1&landingPath=NotLandingPage&groups=C0001:1,BG1403:1,C0002:1,C0003:1,BG1404:1,C0004:1,BG1405:1&geolocation=IT;&AwaitingReconsent=false; ass=3e887a41-7683-48df-909d-d1f3e5370486.1664815576.1664813228; _gcl_au=1.1.192985240.1664694131; usprivacy=1---; OneTrustWPCCPAGoogleOptOut=false; _scid=62382352-4832-438c-a74d-30699989ca96; _fbp=fb.1.1664694351012.468612256; __telemetric.v=1599968982.1664694367.81679; __zlcmid=1CFlGmqJqevtvtz; aam_uuid=50034166116354787000738543341305359891; _tt_enable_cookie=1; _ttp=45eb20c2-a55e-4740-be63-01b5e4166bd3; _hjSessionUser_2533509=eyJpZCI6IjM5NDAxNDA3LTllZDQtNWI1ZC1iYjY4LTRiNDlhOWIzMzZhOSIsImNyZWF0ZWQiOjE2NjQ2OTQzNjcxNDQsImV4aXN0aW5nIjp0cnVlfQ==; _clck=ji7lnf|1|f5d|0; AMCV_9AE0F0145936E3790A495CAA@AdobeOrg=-1124106680|MCIDTS|19268|MCMID|50189272745869278580790010530934545485|MCAAMLH-1665300361|6|MCAAMB-1665300361|RKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y|MCOPTOUT-1664702762s|NONE|MCSYNCSOP|411-19275|vVersion|5.2.0; cSId=1664708822503b864ac8bd7f157ea81fed2f8dd61b56e; __telemetric.s=1.1664813236.1664815036; _hjIncludedInSessionSample=0; _hjSession_2533509=eyJpZCI6IjMzZDczZjEzLTU4YTEtNDRhYy1hMGU5LTU0YjAzMmIyY2ZkMiIsImNyZWF0ZWQiOjE2NjQ4MTMyMzk1MDYsImluU2FtcGxlIjpmYWxzZX0=; _hjAbsoluteSessionInProgress=1; _uetsid=1ce9f6f0433611edb2ca03f99e7c11e1; _uetvid=c8269d50422011ed952c2140169cc91d; ABTasty=uid=4hnc3e5beewkxmkz&fst=1664694364438&pst=1664708830113&cst=1664813235740&ns=3&pvt=11&pvis=4&th=; ABTastySession=mrasn=&sen=3&lp=https%3A%2F%2Fwww.discoveryplus.com%2Fit%2F; muxData=mux_viewer_id=b31419d4-63b3-49a1-80fb-454eee8640bf&msn=0.8573066692553866&sid=145c6df8-a95d-4b5f-89c9-980af79a3c3c&sst=1664813544876.1&sex=1664815194556" --no-part --restrict-filenames --referer "https:www.discoveryplus.com/" "https://www.discoveryplus.com/video/fratelli-di-crozza/stagione-4-episodio-1-del-28-febbraio-2020"
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--add-header', 'Cookie:ass=5492a7cc-e738-41de-a74e-c3e2d46a41cb.1664712738.1664708916; OptanonAlertBoxClosed=2022-10-02T07:05:47.480Z; eupubconsent-v2=CPgPCqcPgPCqcAcABBENCjCsAP_AAH_AACiQJBNf_X__b2_j-_5_f_t0eY1P9_7__-0zjhfdl-8N3f_X_L8X52M7vF36tq4KuR4Eu3LBIUdlHOHcTUmw6okVryOsbk2cr7NKJ7PEmnMbOydYGH9_n1_z-ZKY7__vf_7zvneAA75iAGAEAIASQggAgAAABAIAAAOABAAAABIAAAAAgAgAAAAAAAAAAAAAAP3_798EggCTDVuIAuxLHAm2jCKBECMKwkOoFABRQDC0QGEDq4KdlcBPrCBAAgFAEYEQIcQUYMAgAAAgCQiICQI8EAiAIgEAAIAFQiEABGwCCgAsDAIABQDQsUYoAhAkIMiAiKUwICAAAoBACAAAAAAEQAAAAAAAgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEqFaAA.f_gAD_gAAAAA; OptanonConsent=isIABGlobal=false&datestamp=Mon+Oct+03+2022+18:07:15+GMT+0200+(Ora+legale+dell’Europa+centrale)&version=6.20.0&hosts=&consentId=4bccc028-2368-4b86-a337-24e3495a551f&interactionCount=1&landingPath=NotLandingPage&groups=C0001:1,BG1403:1,C0002:1,C0003:1,BG1404:1,C0004:1,BG1405:1&geolocation=IT;&AwaitingReconsent=false; ass=3e887a41-7683-48df-909d-d1f3e5370486.1664815576.1664813228; _gcl_au=1.1.192985240.1664694131; usprivacy=1---; OneTrustWPCCPAGoogleOptOut=false; _scid=62382352-4832-438c-a74d-30699989ca96; _fbp=fb.1.1664694351012.468612256; __telemetric.v=1599968982.1664694367.81679; __zlcmid=1CFlGmqJqevtvtz; aam_uuid=50034166116354787000738543341305359891; _tt_enable_cookie=1; _ttp=45eb20c2-a55e-4740-be63-01b5e4166bd3; _hjSessionUser_2533509=eyJpZCI6IjM5NDAxNDA3LTllZDQtNWI1ZC1iYjY4LTRiNDlhOWIzMzZhOSIsImNyZWF0ZWQiOjE2NjQ2OTQzNjcxNDQsImV4aXN0aW5nIjp0cnVlfQ==; _clck=ji7lnf|1|f5d|0; AMCV_9AE0F0145936E3790A495CAA@AdobeOrg=-1124106680|MCIDTS|19268|MCMID|50189272745869278580790010530934545485|MCAAMLH-1665300361|6|MCAAMB-1665300361|RKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y|MCOPTOUT-1664702762s|NONE|MCSYNCSOP|411-19275|vVersion|5.2.0; cSId=1664708822503b864ac8bd7f157ea81fed2f8dd61b56e; __telemetric.s=1.1664813236.1664815036; _hjIncludedInSessionSample=0; _hjSession_2533509=eyJpZCI6IjMzZDczZjEzLTU4YTEtNDRhYy1hMGU5LTU0YjAzMmIyY2ZkMiIsImNyZWF0ZWQiOjE2NjQ4MTMyMzk1MDYsImluU2FtcGxlIjpmYWxzZX0=; _hjAbsoluteSessionInProgress=1; _uetsid=1ce9f6f0433611edb2ca03f99e7c11e1; _uetvid=c8269d50422011ed952c2140169cc91d; ABTasty=uid=4hnc3e5beewkxmkz&fst=1664694364438&pst=1664708830113&cst=1664813235740&ns=3&pvt=11&pvis=4&th=; ABTastySession=mrasn=&sen=3&lp=https%3A%2F%2Fwww.discoveryplus.com%2Fit%2F; muxData=mux_viewer_id=b31419d4-63b3-49a1-80fb-454eee8640bf&msn=0.8573066692553866&sid=145c6df8-a95d-4b5f-89c9-980af79a3c3c&sst=1664813544876.1&sex=1664815194556', '--no-part', '--restrict-filenames', '--referer', 'https:www.discoveryplus.com/', 'https://www.discoveryplus.com/video/fratelli-di-crozza/stagione-4-episodio-1-del-28-febbraio-2020']
[debug] Adding header from command line option Cookie:ass=5492a7cc-e738-41de-a74e-c3e2d46a41cb.1664712738.1664708916; OptanonAlertBoxClosed=2022-10-02T07:05:47.480Z; eupubconsent-v2=CPgPCqcPgPCqcAcABBENCjCsAP_AAH_AACiQJBNf_X__b2_j-_5_f_t0eY1P9_7__-0zjhfdl-8N3f_X_L8X52M7vF36tq4KuR4Eu3LBIUdlHOHcTUmw6okVryOsbk2cr7NKJ7PEmnMbOydYGH9_n1_z-ZKY7__vf_7zvneAA75iAGAEAIASQggAgAAABAIAAAOABAAAABIAAAAAgAgAAAAAAAAAAAAAAP3_798EggCTDVuIAuxLHAm2jCKBECMKwkOoFABRQDC0QGEDq4KdlcBPrCBAAgFAEYEQIcQUYMAgAAAgCQiICQI8EAiAIgEAAIAFQiEABGwCCgAsDAIABQDQsUYoAhAkIMiAiKUwICAAAoBACAAAAAAEQAAAAAAAgEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFEqFaAA.f_gAD_gAAAAA; OptanonConsent=isIABGlobal=false&datestamp=Mon+Oct+03+2022+18:07:15+GMT+0200+(Ora+legale+dell’Europa+centrale)&version=6.20.0&hosts=&consentId=4bccc028-2368-4b86-a337-24e3495a551f&interactionCount=1&landingPath=NotLandingPage&groups=C0001:1,BG1403:1,C0002:1,C0003:1,BG1404:1,C0004:1,BG1405:1&geolocation=IT;&AwaitingReconsent=false; ass=3e887a41-7683-48df-909d-d1f3e5370486.1664815576.1664813228; _gcl_au=1.1.192985240.1664694131; usprivacy=1---; OneTrustWPCCPAGoogleOptOut=false; _scid=62382352-4832-438c-a74d-30699989ca96; _fbp=fb.1.1664694351012.468612256; __telemetric.v=1599968982.1664694367.81679; __zlcmid=1CFlGmqJqevtvtz; aam_uuid=50034166116354787000738543341305359891; _tt_enable_cookie=1; _ttp=45eb20c2-a55e-4740-be63-01b5e4166bd3; _hjSessionUser_2533509=eyJpZCI6IjM5NDAxNDA3LTllZDQtNWI1ZC1iYjY4LTRiNDlhOWIzMzZhOSIsImNyZWF0ZWQiOjE2NjQ2OTQzNjcxNDQsImV4aXN0aW5nIjp0cnVlfQ==; _clck=ji7lnf|1|f5d|0; AMCV_9AE0F0145936E3790A495CAA@AdobeOrg=-1124106680|MCIDTS|19268|MCMID|50189272745869278580790010530934545485|MCAAMLH-1665300361|6|MCAAMB-1665300361|RKhpRz8krg2tLO6pguXWp5olkAcUniQYPHaMWWgdJ3xzPWQmdj0y|MCOPTOUT-1664702762s|NONE|MCSYNCSOP|411-19275|vVersion|5.2.0; cSId=1664708822503b864ac8bd7f157ea81fed2f8dd61b56e; __telemetric.s=1.1664813236.1664815036; _hjIncludedInSessionSample=0; _hjSession_2533509=eyJpZCI6IjMzZDczZjEzLTU4YTEtNDRhYy1hMGU5LTU0YjAzMmIyY2ZkMiIsImNyZWF0ZWQiOjE2NjQ4MTMyMzk1MDYsImluU2FtcGxlIjpmYWxzZX0=; _hjAbsoluteSessionInProgress=1; _uetsid=1ce9f6f0433611edb2ca03f99e7c11e1; _uetvid=c8269d50422011ed952c2140169cc91d; ABTasty=uid=4hnc3e5beewkxmkz&fst=1664694364438&pst=1664708830113&cst=1664813235740&ns=3&pvt=11&pvis=4&th=; ABTastySession=mrasn=&sen=3&lp=https%3A%2F%2Fwww.discoveryplus.com%2Fit%2F; muxData=mux_viewer_id=b31419d4-63b3-49a1-80fb-454eee8640bf&msn=0.8573066692553866&sid=145c6df8-a95d-4b5f-89c9-980af79a3c3c&sst=1664813544876.1&sex=1664815194556
[debug] Encodings: locale cp1252, fs mbcs, out cp850, pref cp1252
[debug] youtube-dl version 2021.12.17
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.19041
[debug] exe versions: ffmpeg 2022-09-26-git-dd2ea014ef-full_build-www.gyan.dev, ffprobe 2022-09-26-git-dd2ea014ef-full_build-www.gyan.dev
[debug] Proxy map: {}
[debug] Using fake IP 6.195.43.158 (US) as X-Forwarded-For.
[DiscoveryPlus] fratelli-di-crozza/stagione-4-episodio-1-del-28-febbraio-2020: Downloading JSON metadata
Traceback (most recent call last):
File "__main__.py", line 19, in <module>
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\__init__.py", line 475, in main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\__init__.py", line 465, in _real_main
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 2069, in download
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 808, in extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 815, in wrapper
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 836, in __extract_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 534, in extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\dplay.py", line 340, in _real_extract
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\dplay.py", line 206, in _get_disco_api_info
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 899, in _download_json
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 877, in _download_json_handle
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 667, in _download_webpage_handle
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\extractor\common.py", line 634, in _request_webpage
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\YoutubeDL.py", line 2288, in urlopen
File "C:\Python\Python34\lib\urllib\request.py", line 464, in open
File "C:\Python\Python34\lib\urllib\request.py", line 482, in _open
File "C:\Python\Python34\lib\urllib\request.py", line 442, in _call_chain
File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmpupik7c6w\build\youtube_dl\utils.py", line 2737, in https_open
File "C:\Python\Python34\lib\urllib\request.py", line 1183, in do_open
File "C:\Python\Python34\lib\http\client.py", line 1137, in request
File "C:\Python\Python34\lib\http\client.py", line 1177, in _send_request
File "C:\Python\Python34\lib\http\client.py", line 1109, in putheader
UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 664: ordinal not in range(256)
C:\ytdl>
Description
When I use command to download a DRM video from dplay (www.discoveryplus.com) italian location, I set up this command removing /it/ part from URL.
youtube-dl.exe --add-header "Cookie:HERE I COPIED COOKIE (VERY LONG)" --no-part --restrict-filenames --referer "https:www.discoveryplus.com/" "https://www.discoveryplus.com/video/fratelli-di-crozza/stagione-4-episodio-1-del-28-febbraio-2020"
But I get this errors

I was taken cookie (very long string) from here

About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (5 by maintainers)
If you use yt-dlp, see the comment at the end of https://github.com/ytdl-org/youtube-dl/issues/31279#issuecomment-1268758543. Otherwise, you can install cookie-export add-on/extension in the browser, or just pull the
stcookie from the dev tools as you did before.My tests have shown that ONLY the cookie named
stis indispensable foryt-dlpgaining “access” to the video:=>
@francoross
dirkf is the current and sole maintainer of the original
youtube-dlproject; below, in the form of summary, is what has been established in this thread:In its present state,
youtube-dlis UNABLE to perform downloading from the service (DiscoveryPlusItaly) you want it to 😭 … It can and may be fixed though (in the undefined future), as per:(probably “coder’s lingo” you don’t fully understand 😉 …).
Thus, dirkf has proposed you try the forked project called
yt-dlp, https://github.com/yt-dlp/yt-dlp which is a feature-richer application currently maintained by a wider team of developers and has (probably) a larger user community… I have proved thatyt-dlpis (mostly) suitable for your needs, provided you use the proper, “Italian versions”, of the programme URLs…This here is the
youtube-dlissue tracker, so, as already instructed,so whatever queries/bugs you have regarding
yt-dlpand D±IT, they should be forwarded to https://github.com/yt-dlp/yt-dlp/issuesIt’s obvious you have some “usage” issues of both
youtube-dlandyt-dlp, but an issue tracker isn’t meant to serve as a knowledgebase and/or user forum (although many people, not counting myself out 😉 , have/are using it thinking it is…); both apps haveREAD.mesections where options and their values are explained; plus, their issue trackers are searchable, meaning you can search for a “question” similar to yours; it’s highly probable someone else had the same question before and a dev or advanced user has provided answer(s)… E.g.https://github.com/ytdl-org/youtube-dl/issues/30665#issuecomment-1069318804
(sadly, the user there hasn’t made linkification correctly, but if you just copy the URL-strings - instead of clicking on them - and “paste-and-go” them in a new tab, they should work!)
But, the easiest thing for you to do is reach out to your favourite search engine and simply ask the question there; that’s what I did and came up with: https://www.nellump.net/downloading-videos-with-youtube-dl/
With respect, don’t expect everything offered up to you on a plate to eat… Don’t take this the wrong way please 😄 , but if you don’t search for missing knowledge yourself, you’re likely to forget what has been spoon-fed to you by others…
Kindest regards.
Even without G Translate or having been to an Italian restaurant, I think you can correctly guess that the top bar menu commands are “Log in” and “Register” (strictly “access” [verb] and “register yourself”).
General resolution of the problems observed in this issue requires two back-ports from yt-dlp:
LenientSimpleCookieas linked aboveextractor/dplay.py.