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

KeyError: 'title' on ydl.extract_info() with "YoutubeDL({'check_formats': True})" #1709

Closed
6 tasks done
jakeogh opened this issue Nov 19, 2021 · 0 comments
Closed
6 tasks done
Assignees
Labels
bug Bug that is not site-specific

Comments

@jakeogh
Copy link
Contributor

jakeogh commented Nov 19, 2021

Checklist

  • I'm reporting a bug unrelated to a specific site
  • I've verified that I'm running yt-dlp version 2021.11.10.1. (update instructions)
  • 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 issues including closed ones. DO NOT post duplicates
  • I've read the guidelines for opening an issue

Description

using git-latest a04e005:

$ ipython
Python 3.9.7 (default, Oct  5 2021, 15:51:35) 

In [1]: /delme >>>: from yt_dlp import YoutubeDL

In [2]: /delme >>>: url = "https://www.youtube.com/watch?v=ulxxfL6X3Ig"

In [3]: /delme >>>: with YoutubeDL({'check_formats': True}) as ydl:
               ...:     ydl.extract_info(url)
               ...: 
[youtube] ulxxfL6X3Ig: Downloading webpage
[youtube] ulxxfL6X3Ig: Downloading android player API JSON
[youtube] ulxxfL6X3Ig: Downloading MPD manifest
[youtube] ulxxfL6X3Ig: Downloading MPD manifest
[info] Testing format 247
[info] Testing format 22
[info] Testing format 136
[info] Testing format 136-dash
[info] Testing format 244
[info] Testing format 135
[info] Testing format 243
[info] Testing format 18
[info] Testing format 134
[info] Testing format 134-dash
[info] Testing format 242
[info] Testing format 133
[info] Testing format 278
[info] Testing format 160
[info] Testing format 17
[info] Testing format 251
[info] Testing format 251-dash
[info] Testing format 140
[info] Testing format 140-dash
[info] Testing format 139
[info] Testing format 139-dash
[info] Testing format sb0
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-3-a7e9c26c78b6> in <module>
      1 with YoutubeDL({'check_formats': True}) as ydl:
----> 2     ydl.extract_info(url)
      3 

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in extract_info(self, url, download, ie_key, extra_info, process, force_generic_extractor)
   1307                                ie_key, temp_id))
   1308                 break
-> 1309             return self.__extract_info(url, self.get_info_extractor(ie_key), download, extra_info, process)
   1310         else:
   1311             self.report_error('no suitable InfoExtractor for URL %s' % url)

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in wrapper(self, *args, **kwargs)
   1315         def wrapper(self, *args, **kwargs):
   1316             try:
-> 1317                 return func(self, *args, **kwargs)
   1318             except GeoRestrictedError as e:
   1319                 msg = e.msg

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in __extract_info(self, url, ie, download, extra_info, process)
   1353         self.add_default_extra_info(ie_result, ie, url)
   1354         if process:
-> 1355             return self.process_ie_result(ie_result, download, extra_info)
   1356         else:
   1357             return ie_result

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in process_ie_result(self, ie_result, download, extra_info)
   1403         if result_type == 'video':
   1404             self.add_extra_info(ie_result, extra_info)
-> 1405             ie_result = self.process_video_result(ie_result, download=download)
   1406             additional_urls = (ie_result or {}).get('additional_urls')
   1407             if additional_urls:

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in process_video_result(self, info_dict, download)
   2364             formats = LazyList(self._check_formats(formats[::-1])).reverse()
   2365 
-> 2366         if not formats or formats[0] is not info_dict:
   2367             # only set the 'formats' fields if the original info_dict list them
   2368             # otherwise we end up with a circular reference, the first (and unique)

/usr/lib/python3.9/site-packages/yt_dlp/utils.py in __getitem__(self, idx)
   4145             # We need to consume the entire iterable to be able to slice from the end
   4146             # Obviously, never use this with infinite iterables
-> 4147             self.__exhaust()
   4148             try:
   4149                 return self.__cache[idx]

/usr/lib/python3.9/site-packages/yt_dlp/utils.py in __exhaust(self)
   4116 
   4117     def __exhaust(self):
-> 4118         self.__cache.extend(self.__iterable)
   4119         # Discard the emptied iterable to make it pickle-able
   4120         self.__iterable = []

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in _check_formats(self, formats)
   1745             temp_file.close()
   1746             try:
-> 1747                 success, _ = self.dl(temp_file.name, f, test=True)
   1748             except (DownloadError, IOError, OSError, ValueError) + network_exceptions:
   1749                 success = False

/usr/lib/python3.9/site-packages/yt_dlp/YoutubeDL.py in dl(self, name, info, subtitle, test)
   2594         if new_info.get('http_headers') is None:
   2595             new_info['http_headers'] = self._calc_headers(new_info)
-> 2596         return fd.download(name, new_info, subtitle)
   2597 
   2598     def process_info(self, info_dict):

/usr/lib/python3.9/site-packages/yt_dlp/downloader/common.py in download(self, filename, info_dict, subtitle)
    397                         sleep_interval_sub))
    398                 time.sleep(sleep_interval_sub)
--> 399         ret = self.real_download(filename, info_dict)
    400         self._finish_multiline_status()
    401         return ret, True

/usr/lib/python3.9/site-packages/yt_dlp/downloader/mhtml.py in real_download(self, filename, info_dict)
    115         fragments = info_dict['fragments'][:1] if self.params.get(
    116             'test', False) else info_dict['fragments']
--> 117         title = info_dict['title']
    118         origin = info_dict['webpage_url']
    119 

KeyError: 'title'

Verbose log

I haven't been able to trigger it from the CLI yet.
@jakeogh jakeogh added bug Bug that is not site-specific triage Untriaged issue labels Nov 19, 2021
@pukkandan pukkandan removed the triage Untriaged issue label Nov 19, 2021
@pukkandan pukkandan self-assigned this Nov 19, 2021
gaming-hacker added a commit to gaming-hacker/yt-dlp that referenced this issue Nov 23, 2021
* commit 'ff51ed588fa75256b98ead67bdef7edda08b66f0': (45 commits)
  Clarify video/audio-only formats in -F Related: yt-dlp#1759
  [jsinterp] Fix splice to handle float Needed for new youtube js player f1ca6900 Closes yt-dlp#1767
  [tv2] Expand valid URL Closes yt-dlp#1764
  [sbs] Fix for movies and livestreams Closes yt-dlp#1640
  [itv] Fix for Python 3.6/3.7 Closes yt-dlp#1758
  [extractor] Extract `average_rating` from JSON-LD Eg: Crunchyroll
  [ARDBetaMediathek] Handle new URLs Adapted from ytdl-org/youtube-dl@8562218 Closes yt-dlp#1601
  Ensure path for link files exists (yt-dlp#1755) Authored by: Zirro
  [mediaklikk] Expand valid URL Partial fix for yt-dlp#1409
  [vimeo] Add fallback for config URL Closes yt-dlp#1662
  [downloader/ffmpeg] Fix for direct videos inside mpd manifests Closes yt-dlp#1751
  [WDR] Expand valid URL Closes yt-dlp#1749
  [xvideos] Detect embed URLs (yt-dlp#1729)
  [CozyTV] Add extractor (yt-dlp#1727)
  [willow] Add extractor (yt-dlp#1723)
  Fix `--check-formats` for `mhtml` Closes yt-dlp#1709
  [utils] Fix error when copying `LazyList`
  [utils] Fix `PagedList` Bug in d8cf8d9
  [utils] Allow alignment in `render_table` and add tests
  [bbc] Get all available formats (yt-dlp#1717)
  ...

# Conflicts:
#	README.md
#	yt_dlp/utils.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is not site-specific
Projects
None yet
Development

No branches or pull requests

2 participants