mirror of
https://github.com/l1ving/youtube-dl
synced 2025-03-13 20:17:15 +08:00
[nationalarchivesuk] Edit to flake8 standards
This commit is contained in:
parent
f03b60c1e1
commit
3ecfbf9c10
@ -9,24 +9,25 @@ from .common import InfoExtractor
|
|||||||
class NationalArchivesUkIE(InfoExtractor):
|
class NationalArchivesUkIE(InfoExtractor):
|
||||||
_VALID_URL = r'https?://media.nationalarchives.gov.uk/index.php/(?P<id>.*)/?'
|
_VALID_URL = r'https?://media.nationalarchives.gov.uk/index.php/(?P<id>.*)/?'
|
||||||
_TEST = {
|
_TEST = {
|
||||||
'url': 'http://media.nationalarchives.gov.uk/index.php/webinar-using-discovery-national-archives-online-catalogue/'
|
'url': 'http://media.nationalarchives.gov.uk/index.php/webinar-using-discovery-national-archives-online-catalogue/',
|
||||||
# TODO more properties, either as:
|
'info_dict': {
|
||||||
# * A value
|
'id': 'Mrj4DVp2zeA',
|
||||||
# * MD5 checksum; start the string with md5:
|
'ext': 'mp4',
|
||||||
# * A regular expression; start the string with re:
|
|
||||||
# * Any Python type (for example int or float)
|
'upload_date': '20150204',
|
||||||
|
'uploader_id': 'NationalArchives08',
|
||||||
|
'title': 'Webinar: Using Discovery, The National Archives’ online catalogue',
|
||||||
|
'uploader': 'The National Archives UK',
|
||||||
|
'description': 'md5:a236581cd2449dd2df4f93412f3f01c6'
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def _real_extract(self, url):
|
def _real_extract(self, url):
|
||||||
video_id = self._match_id(url)
|
video_id = self._match_id(url)
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
youtube_url = re.search(r'https?://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?', webpage)
|
youtube_url = re.search(r'https?://(?:www\.)?youtu(?:be\.com/watch\?v=|\.be/)(\w*)(&(amp;)?[\w\?=]*)?',
|
||||||
print(youtube_url)
|
webpage, re.MULTILINE).group(0)
|
||||||
|
self.to_screen('Youtube video detected')
|
||||||
|
|
||||||
return {
|
return self.url_result(youtube_url, ie='Youtube')
|
||||||
'id': video_id,
|
|
||||||
'title': title,
|
|
||||||
'description': self._og_search_description(webpage),
|
|
||||||
# TODO more properties (see youtube_dl/extractor/common.py)
|
|
||||||
}
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user