Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Downloading YouTube History fails on parsing JSON #17940

Open
ealgase opened this issue Oct 21, 2018 · 2 comments
Open

Downloading YouTube History fails on parsing JSON #17940

ealgase opened this issue Oct 21, 2018 · 2 comments

Comments

@ealgase
Copy link
Contributor

@ealgase ealgase commented Oct 21, 2018

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like this: [x])
  • Use the Preview tab to see what your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2018.10.05. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2018.10.05

Before submitting an issue make sure you have:

  • At least skimmed through the README, most notably the FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones
  • Checked that provided video/audio/playlist URLs (if any) are alive and playable in a browser

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add the -v flag to your command line you run youtube-dl with (youtube-dl -v <your command line>), copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', ':ythistory', '--username', 'PRIVATE', '--password=PRIVATE', '-f', 'worstvideo+worstaudio']
[debug] Encodings: locale cp1252, fs mbcs, out cp437, pref cp1252
[debug] youtube-dl version 2018.10.05
[debug] Python version 3.4.4 (CPython) - Windows-10-10.0.17134
[debug] exe versions: ffmpeg N-91712-g26dc763245, ffprobe N-91712-g26dc763245
[debug] Proxy map: {}
[youtube:history] Downloading login page
[youtube:history] Looking up account info
[youtube:history] Logging in
[youtube:history] Checking cookie
[youtube:history] Youtube History: Downloading webpage
[download] Downloading playlist: Youtube History
[youtube:history] Youtube History: Downloading page #1
[youtube:history] Youtube History: Downloading page #2
[youtube:history] Youtube History: Downloading page #3
[youtube:history] Youtube History: Downloading page #4
[youtube:history] Youtube History: Downloading page #5
[youtube:history] Youtube History: Downloading page #6
[youtube:history] Youtube History: Downloading page #7
[youtube:history] Youtube History: Downloading page #8
[youtube:history] Youtube History: Downloading page #9
[youtube:history] Youtube History: Downloading page #10
[youtube:history] Youtube History: Downloading page #11
ERROR: Youtube History: Failed to parse JSON  (caused by ValueError('Invalid \\escape: line 1 column 587495 (char 587494)',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 871, in _parse_json
  File "C:\Python\Python34\lib\json\__init__.py", line 318, in loads
  File "C:\Python\Python34\lib\json\decoder.py", line 343, in decode
  File "C:\Python\Python34\lib\json\decoder.py", line 359, in raw_decode
ValueError: Invalid \escape: line 1 column 587495 (char 587494)
Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 871, in _parse_json
  File "C:\Python\Python34\lib\json\__init__.py", line 318, in loads
  File "C:\Python\Python34\lib\json\decoder.py", line 343, in decode
  File "C:\Python\Python34\lib\json\decoder.py", line 359, in raw_decode
ValueError: Invalid \escape: line 1 column 587495 (char 587494)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\YoutubeDL.py", line 803, in extract_info
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\YoutubeDL.py", line 963, in process_ie_result
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\youtube.py", line 2796, in _entries
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 864, in _download_json
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 848, in _download_json_handle
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\rg3\tmp5xdqinp2\build\youtube_dl\extractor\common.py", line 875, in _parse_json
youtube_dl.utils.ExtractorError: Youtube History: Failed to parse JSON  (caused by ValueError('Invalid \\escape: line 1 column 587495 (char 587494)',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; type  youtube-dl -U  to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
<end of log>

Description of your issue, suggested solution and other information

I am trying to download all of the videos I have watched on YouTube. I've provided the correct username and password. However, the program fails after downloading page 11 of the history list.

My suggested solution is to check if the JSON format that the page is provided in has changed, as this is probably a rarely used feature, and YouTube's redesign may have messed things up.

@ispedals
Copy link
Contributor

@ispedals ispedals commented Oct 22, 2018

I was not able to reproduce the issue (using Python 3.7, --simulate and a personal account). The error suggests that YouTube is returning invalid JSON, Given that I was not able to reproduce it and the error does not occur until the 11 page for you, the error is probably due to some character in a video title or channel name that is not properly being encoded by YouTube (based on this answer).

If you can, try running the command again, but with the --write-pages flag and see what character is present at position 587,494-587,495 in the file that fails.

@ealgase
Copy link
Contributor Author

@ealgase ealgase commented Oct 23, 2018

The surrounding area is
class=\"yt-uix-sessionlink
with the l being the character that causes the failure.

Note: I've watched more videos since making this issue, so I went to the new location the error was at.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.