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

--get-info-json: TypeError: Object of type function is not JSON serializable #36

Open
5 of 6 tasks
Slider-Whistle opened this issue May 30, 2021 · 0 comments
Open
5 of 6 tasks

Comments

@Slider-Whistle
Copy link

Checklist

  • I'm reporting a broken site support issue
  • I've verified that I'm running youtube-dl version 2020.12.14
  • 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

python3.8 /home/houston/animelover1984-youtube-dl/youtube_dl/__main__.py -v --ignore-config -o "$HOME/Youtube Archives/%(uploader)s/%(upload_date)s %(title)s.%(ext)s" --netrc --write-thumbnail --write-annotations --write-sub --all-subs --write-info-json --get-comments --split-tracks https://www.youtube.com/watch?v=21iM7dSB6JU
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--ignore-config', '-o', '/home/houston/Youtube Archives/%(uploader)s/%(upload_date)s %(title)s.%(ext)s', '--netrc', '--write-thumbnail', '--write-annotations', '--write-sub', '--all-subs', '--write-info-json', '--get-comments', '--split-tracks', 'https://www.youtube.com/watch?v=21iM7dSB6JU']
[debug] Encodings: locale UTF-8, fs utf-8, out utf-8, pref UTF-8
[debug] youtube-dl version 2020.12.14
[debug] Git HEAD: 458e7fd52
[debug] Python version 3.8.10 (CPython) - Linux-5.12.0-gentoo-x86_64-x86_64-AMD_Ryzen_5_1600_Six-Core_Processor-with-glibc2.2.5
[debug] exe versions: ffmpeg 4.4, ffprobe 4.4
[debug] Proxy map: {}
[youtube] Downloading login page
[youtube] Looking up account info
WARNING: Unable to look up account info: HTTP Error 400: Bad Request
[youtube] 21iM7dSB6JU: Downloading webpage
[debug] Default format spec: bestvideo+bestaudio/best
WARNING: There are no annotations to write.
[info] Writing video description metadata as JSON to: /home/houston/Youtube Archives/garrrzzz/20140216 DDS - Megami Tensei - Piano arrangement medley.info.json
Traceback (most recent call last):
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/__main__.py", line 19, in <module>
    youtube_dl.main()
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/__init__.py", line 482, in main
    _real_main(argv)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/__init__.py", line 472, in _real_main
    retcode = ydl.download(all_urls)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 2054, in download
    res = self.extract_info(
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 797, in extract_info
    return self.__extract_info(url, ie, download, extra_info, process)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 804, in wrapper
    return func(self, *args, **kwargs)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 836, in __extract_info
    return self.process_ie_result(ie_result, download, extra_info)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 870, in process_ie_result
    return self.process_video_result(ie_result, download=download)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 1680, in process_video_result
    self.process_info(new_info)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/YoutubeDL.py", line 1886, in process_info
    write_json_file(self.filter_requested_info(info_dict), infofn)
  File "/home/houston/animelover1984-youtube-dl/youtube_dl/utils.py", line 1832, in write_json_file
    json.dump(obj, tf)
  File "/usr/lib/python3.8/json/__init__.py", line 179, in dump
    for chunk in iterable:
  File "/usr/lib/python3.8/json/encoder.py", line 431, in _iterencode
    yield from _iterencode_dict(o, _current_indent_level)
  File "/usr/lib/python3.8/json/encoder.py", line 405, in _iterencode_dict
    yield from chunks
  File "/usr/lib/python3.8/json/encoder.py", line 438, in _iterencode
    o = _default(o)
  File "/usr/lib/python3.8/json/encoder.py", line 179, in default
    raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type function is not JSON serializable

Description

This fork of youtube-dl appears to crash whenever I give it either the arguments --write-description, or --write-info-json, which appears to imply write-description all the same. Since write-info-json appears to be necessary for writing comments, this is a somewhat serious issue, at least if it's reproducible. Have tested using python 3.7 as well, output is similar to above. If there's a workaround that involves passing the write-info-json argument in a way that doesn't put the description inside the json, that would also be appreciated. Don't get this bug in normal youtube-dl. I was wondering whether there may be some kind of upstream fix that's failed to get applied, but couldn't find anything searching their issues/PR's.

Thanks for your time.

animelover1984 pushed a commit that referenced this issue Jul 4, 2021
[bandcamp] restore album downloads
animelover1984 pushed a commit that referenced this issue Jul 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant