Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Fix line endings handling for downloaded web pages #10268
Comments
|
Which URL are you trying to downloading? |
|
I was downloading |
|
Fixed as #10269 merged. Thanks! |
Make sure you are using the latest version: run
youtube-dl --versionand ensure your version is 2016.08.07. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.Before submitting an issue make sure you have:
What is the purpose of your issue?
Description of your issue, suggested solution and other information
This error is found while trying to download a subtitle from http://d2anahhhmp1ffz.cloudfront.net/1828211116/0de60692c14fea8784203ca9f696a6be874beb52, format: SRT, encoding: utf-8, line ending: CRLF. the first 70 bytes of the response is
b'\xef\xbb\xbf1\r\n00:00:20,173 --> 00:00:21,303\r\n(Episode 1)\r\n\r\n2\r\n00:00:50,559 --'However the written subtitle file has all '\r\n' replaced to '\r\r\n', which breaks the SRT format and caused some players not rendering the correct subtitle lines.
Suggested solution
fix the decoding of downloaded webpage content with io streams instead of bytes.decode(), so python will handle the normalization of line endings, at
C:\Users\Me\git\youtube-dl\youtube_dl\extractor\common.py: def _webpage_read_content()