mirror of
https://github.com/l1ving/youtube-dl
synced 2024-11-24 08:02:50 +08:00
Fix test, remove unused, tidy quotes and brackets
This commit is contained in:
parent
50a138d95c
commit
4534485586
@ -13,21 +13,24 @@ class GDCVaultIE(InfoExtractor):
|
|||||||
_VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)'
|
_VALID_URL = r'https?://(?:www\.)?gdcvault\.com/play/(?P<id>\d+)/(?P<name>(\w|-)+)'
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
u'url': u'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple',
|
'url': 'http://www.gdcvault.com/play/1019721/Doki-Doki-Universe-Sweet-Simple',
|
||||||
u'md5': u'7ce8388f544c88b7ac11c7ab1b593704',
|
'md5': '7ce8388f544c88b7ac11c7ab1b593704',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"id": u"1019721",
|
'id': '1019721',
|
||||||
u"ext": u"mp4",
|
'ext': 'mp4',
|
||||||
u"title": u"Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)"
|
'title': 'Doki-Doki Universe: Sweet, Simple and Genuine (GDC Next 10)'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
u'url': u'http://www.gdcvault.com/play/1015683/Embracing-the-Dark-Art-of',
|
'url': 'http://www.gdcvault.com/play/1015683/Embracing-the-Dark-Art-of',
|
||||||
u'md5': u'fca91078a90f28aa5164ef6b23b78654',
|
'md5': 'fca91078a90f28aa5164ef6b23b78654',
|
||||||
u'info_dict': {
|
'info_dict': {
|
||||||
u"id": u"1015683",
|
'id': '1015683',
|
||||||
u"ext": u"flv",
|
'ext': 'flv',
|
||||||
u"title": u"Embracing the Dark Art of Mathematical Modeling in AI"
|
'title': 'Embracing the Dark Art of Mathematical Modeling in AI'
|
||||||
|
},
|
||||||
|
'params' : {
|
||||||
|
'skip_download': True, # Requires rtmpdump
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
@ -75,7 +78,7 @@ class GDCVaultIE(InfoExtractor):
|
|||||||
def _login(self, webpage_url, video_id):
|
def _login(self, webpage_url, video_id):
|
||||||
(username, password) = self._get_login_info()
|
(username, password) = self._get_login_info()
|
||||||
if username is None or password is None:
|
if username is None or password is None:
|
||||||
self.report_warning(u'It looks like ' + webpage_url + u' requires a login. Try specifying a username and password and try again.')
|
self.report_warning('It looks like ' + webpage_url + ' requires a login. Try specifying a username and password and try again.')
|
||||||
return None
|
return None
|
||||||
|
|
||||||
mobj = re.match(r'(?P<root_url>https?://.*?/).*', webpage_url)
|
mobj = re.match(r'(?P<root_url>https?://.*?/).*', webpage_url)
|
||||||
@ -108,12 +111,11 @@ class GDCVaultIE(InfoExtractor):
|
|||||||
# Probably need to authenticate
|
# Probably need to authenticate
|
||||||
start_page = self._login(webpage_url, video_id)
|
start_page = self._login(webpage_url, video_id)
|
||||||
if start_page is None:
|
if start_page is None:
|
||||||
self.report_warning(u'Could not login.')
|
self.report_warning('Could not login.')
|
||||||
else:
|
else:
|
||||||
# Grab the url from the authenticated page
|
# Grab the url from the authenticated page
|
||||||
xml_root = self._html_search_regex(r'<iframe src="(?P<xml_root>.*?)player.html.*?".*?</iframe>', start_page, 'xml root')
|
xml_root = self._html_search_regex(r'<iframe src="(?P<xml_root>.*?)player.html.*?".*?</iframe>', start_page, 'xml root')
|
||||||
|
|
||||||
self.report_extraction(video_id)
|
|
||||||
xml_name = self._html_search_regex(r'<iframe src=".*?\?xml=(?P<xml_file>.+?\.xml).*?".*?</iframe>', start_page, 'xml filename', None, False)
|
xml_name = self._html_search_regex(r'<iframe src=".*?\?xml=(?P<xml_file>.+?\.xml).*?".*?</iframe>', start_page, 'xml filename', None, False)
|
||||||
if xml_name is None:
|
if xml_name is None:
|
||||||
# Fallback to the older format
|
# Fallback to the older format
|
||||||
@ -123,17 +125,12 @@ class GDCVaultIE(InfoExtractor):
|
|||||||
xml_description = self._download_xml(xml_decription_url, video_id)
|
xml_description = self._download_xml(xml_decription_url, video_id)
|
||||||
|
|
||||||
video_title = xml_description.find('./metadata/title').text
|
video_title = xml_description.find('./metadata/title').text
|
||||||
video_details = {
|
|
||||||
'id': video_id,
|
|
||||||
'title': video_title,
|
|
||||||
}
|
|
||||||
|
|
||||||
video_formats = self._parse_mp4(xml_description)
|
video_formats = self._parse_mp4(xml_description)
|
||||||
if video_formats is None:
|
if video_formats is None:
|
||||||
video_formats = self._parse_flv(xml_description)
|
video_formats = self._parse_flv(xml_description)
|
||||||
|
|
||||||
return [{
|
return {
|
||||||
'id': video_id,
|
'id': video_id,
|
||||||
'title': video_title,
|
'title': video_title,
|
||||||
'formats': video_formats,
|
'formats': video_formats,
|
||||||
}]
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user