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

Fix KeyError when missing attributes in MPD #20588

Closed
5 tasks
oleksis opened this issue Apr 6, 2019 · 0 comments
Closed
5 tasks

Fix KeyError when missing attributes in MPD #20588

oleksis opened this issue Apr 6, 2019 · 0 comments

Comments

@oleksis
Copy link

oleksis commented Apr 6, 2019

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 2019.04.01. If it's not, read this FAQ entry and update. Issues with outdated version will be rejected.

  • [x ] I've verified and I assure that I'm running youtube-dl 2019.04.01

Before submitting an issue make sure you have:

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

What is the purpose of your issue?

  • [x ] 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

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


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 ```):

"C:\Program Files\Python36\python.exe" D:/PYTHON/youtube-dl/bin/youtube-dl -v --no-check-certificate https://www.picta.cu/medias/inocencia-2019-2019-04-01-17-11-21-603318
[debug] System config: []
[debug] User config: []
[debug] Custom config: []
[debug] Command-line args: ['-v', '--no-check-certificate', 'https://www.picta.cu/medias/inocencia-2019-2019-04-01-17-11-21-603318']
[debug] Encodings: locale cp1252, fs utf-8, out UTF-8, pref cp1252
[debug] youtube-dl version 2019.04.01
[debug] Git HEAD: 9bcbbd811
[debug] Python version 3.6.7 (CPython) - Windows-7-6.1.7601-SP1
[debug] exe versions: ffmpeg N-93056-g1e03d60054, ffprobe N-93056-g1e03d60054
[debug] Proxy map: {}
[picta] inocencia-2019-2019-04-01-17-11-21-603318: Downloading video JSON
[picta] inocencia-2019-2019-04-01-17-11-21-603318: Downloading MPD manifest
WARNING: Unknown codec vp09.00.11.08
ERROR: An extractor error has occurred. (caused by KeyError('sourceURL',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.
Traceback (most recent call last):
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 508, in extract
    ie_result = self._real_extract(url)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\picta.py", line 93, in _real_extract
    formats.extend(self._extract_mpd_formats(info.get('manifest_url'), video_id, formats_dict=self._formats))
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2002, in _extract_mpd_formats
    formats_dict=formats_dict, mpd_url=mpd_url)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2137, in _parse_mpd_formats
    representation_ms_info = extract_multisegment_info(representation, adaption_set_ms_info)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2063, in extract_multisegment_info
    extract_Initialization(segment_list)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2058, in extract_Initialization
    ms_info['initialization_url'] = initialization.attrib['sourceURL']
KeyError: 'sourceURL'
Traceback (most recent call last):
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 508, in extract
    ie_result = self._real_extract(url)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\picta.py", line 93, in _real_extract
    formats.extend(self._extract_mpd_formats(info.get('manifest_url'), video_id, formats_dict=self._formats))
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2002, in _extract_mpd_formats
    formats_dict=formats_dict, mpd_url=mpd_url)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2137, in _parse_mpd_formats
    representation_ms_info = extract_multisegment_info(representation, adaption_set_ms_info)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2063, in extract_multisegment_info
    extract_Initialization(segment_list)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 2058, in extract_Initialization
    ms_info['initialization_url'] = initialization.attrib['sourceURL']
KeyError: 'sourceURL'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\PYTHON\youtube-dl\youtube_dl\YoutubeDL.py", line 796, in extract_info
    ie_result = ie.extract(url)
  File "D:\PYTHON\youtube-dl\youtube_dl\extractor\common.py", line 521, in extract
    raise ExtractorError('An extractor error has occurred.', cause=e)
youtube_dl.utils.ExtractorError: An extractor error has occurred. (caused by KeyError('sourceURL',)); please report this issue on https://yt-dl.org/bug . Make sure you are using the latest version; see  https://yt-dl.org/update  on how to update. Be sure to call youtube-dl with the --verbose flag and include its complete output.



If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):

Note that youtube-dl does not support sites dedicated to copyright infringement. In order for site support request to be accepted all provided example URLs should not violate any copyrights.


Description of your issue, suggested solution and other information

Fix KeyError when missing attributes in MPD
Get element attribute using element.get('key') instead of element.attrib['index'] manifests like:

SegmentList/Initialization@sourceURL
SegmentList/SegmentURL@media

Example MPD manifest https://www.picta.cu/videos/3bf20311b6564d61a0fd519b3c7dcced/manifest.mpd

Related issue #18875
@dstftw @roorolj98y

Pull Commit [picta] Fix KeyError when missing attributes in MPD #0fc37c4

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

No branches or pull requests

2 participants