kopia lustrzana https://github.com/yt-dlp/yt-dlp
[mtv] Modernize and clean up test
rodzic
29aef5a33c
commit
ca0f500ecf
|
@ -79,12 +79,15 @@ class MTVServicesInfoExtractor(SubtitlesInfoExtractor):
|
||||||
try:
|
try:
|
||||||
_, _, ext = rendition.attrib['type'].partition('/')
|
_, _, ext = rendition.attrib['type'].partition('/')
|
||||||
rtmp_video_url = rendition.find('./src').text
|
rtmp_video_url = rendition.find('./src').text
|
||||||
formats.append({'ext': ext,
|
if rtmp_video_url.endswith('siteunavail.png'):
|
||||||
'url': self._transform_rtmp_url(rtmp_video_url),
|
continue
|
||||||
'format_id': rendition.get('bitrate'),
|
formats.append({
|
||||||
'width': int(rendition.get('width')),
|
'ext': ext,
|
||||||
'height': int(rendition.get('height')),
|
'url': self._transform_rtmp_url(rtmp_video_url),
|
||||||
})
|
'format_id': rendition.get('bitrate'),
|
||||||
|
'width': int(rendition.get('width')),
|
||||||
|
'height': int(rendition.get('height')),
|
||||||
|
})
|
||||||
except (KeyError, TypeError):
|
except (KeyError, TypeError):
|
||||||
raise ExtractorError('Invalid rendition field.')
|
raise ExtractorError('Invalid rendition field.')
|
||||||
self._sort_formats(formats)
|
self._sort_formats(formats)
|
||||||
|
@ -240,25 +243,14 @@ class MTVIE(MTVServicesInfoExtractor):
|
||||||
_TESTS = [
|
_TESTS = [
|
||||||
{
|
{
|
||||||
'url': 'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
|
'url': 'http://www.mtv.com/videos/misc/853555/ours-vh1-storytellers.jhtml',
|
||||||
'file': '853555.mp4',
|
|
||||||
'md5': '850f3f143316b1e71fa56a4edfd6e0f8',
|
'md5': '850f3f143316b1e71fa56a4edfd6e0f8',
|
||||||
'info_dict': {
|
'info_dict': {
|
||||||
|
'id': '853555',
|
||||||
|
'ext': 'mp4',
|
||||||
'title': 'Taylor Swift - "Ours (VH1 Storytellers)"',
|
'title': 'Taylor Swift - "Ours (VH1 Storytellers)"',
|
||||||
'description': 'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
|
'description': 'Album: Taylor Swift performs "Ours" for VH1 Storytellers at Harvey Mudd College.',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
'add_ie': ['Vevo'],
|
|
||||||
'url': 'http://www.mtv.com/videos/taylor-swift/916187/everything-has-changed-ft-ed-sheeran.jhtml',
|
|
||||||
'file': 'USCJY1331283.mp4',
|
|
||||||
'md5': '73b4e7fcadd88929292fe52c3ced8caf',
|
|
||||||
'info_dict': {
|
|
||||||
'title': 'Everything Has Changed',
|
|
||||||
'upload_date': '20130606',
|
|
||||||
'uploader': 'Taylor Swift',
|
|
||||||
},
|
|
||||||
'skip': 'VEVO is only available in some countries',
|
|
||||||
},
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def _get_thumbnail_url(self, uri, itemdoc):
|
def _get_thumbnail_url(self, uri, itemdoc):
|
||||||
|
@ -272,8 +264,8 @@ class MTVIE(MTVServicesInfoExtractor):
|
||||||
webpage = self._download_webpage(url, video_id)
|
webpage = self._download_webpage(url, video_id)
|
||||||
|
|
||||||
# Some videos come from Vevo.com
|
# Some videos come from Vevo.com
|
||||||
m_vevo = re.search(r'isVevoVideo = true;.*?vevoVideoId = "(.*?)";',
|
m_vevo = re.search(
|
||||||
webpage, re.DOTALL)
|
r'(?s)isVevoVideo = true;.*?vevoVideoId = "(.*?)";', webpage)
|
||||||
if m_vevo:
|
if m_vevo:
|
||||||
vevo_id = m_vevo.group(1)
|
vevo_id = m_vevo.group(1)
|
||||||
self.to_screen('Vevo video detected: %s' % vevo_id)
|
self.to_screen('Vevo video detected: %s' % vevo_id)
|
||||||
|
|
Ładowanie…
Reference in New Issue