1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2024-11-02 17:22:31 +01:00

[mdr] Simplify xpath

This commit is contained in:
Sergey M․ 2015-10-31 22:45:45 +06:00
parent 578c074575
commit 11465da702

View File

@ -74,8 +74,7 @@ def _real_extract(self, url):
doc = self._download_xml( doc = self._download_xml(
compat_urlparse.urljoin(url, data_url), video_id) compat_urlparse.urljoin(url, data_url), video_id)
title = (xpath_text(doc, './title', 'title', default=None) or title = xpath_text(doc, ['./title', './broadcast/broadcastName'], 'title', fatal=True)
xpath_text(doc, './broadcast/broadcastName', 'title'))
formats = [] formats = []
processed_urls = [] processed_urls = []
@ -149,8 +148,12 @@ def _real_extract(self, url):
description = xpath_text(doc, './broadcast/broadcastDescription', 'description') description = xpath_text(doc, './broadcast/broadcastDescription', 'description')
timestamp = parse_iso8601( timestamp = parse_iso8601(
xpath_text(doc, './broadcast/broadcastDate', 'timestamp', default=None) or xpath_text(
xpath_text(doc, './broadcast/broadcastStartDate', 'timestamp', default=None)) doc, [
'./broadcast/broadcastDate',
'./broadcast/broadcastStartDate',
'./broadcast/broadcastEndDate'],
'timestamp', default=None))
duration = parse_duration(xpath_text(doc, './duration', 'duration')) duration = parse_duration(xpath_text(doc, './duration', 'duration'))
uploader = xpath_text(doc, './rights', 'uploader') uploader = xpath_text(doc, './rights', 'uploader')