X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=youtube_dl%2Fextractor%2Fmlb.py;h=42aa2e227dcb1360af535c92a17edcbdf99f259c;hb=2a834bdb21b1a747ba91b27a582aa48e8f28ec0b;hp=84f50082186fa5b7da7237149420f6f9c4adc8bd;hpb=07cc63f386c6afe253b7707631663072d2fb8789;p=youtube-dl diff --git a/youtube_dl/extractor/mlb.py b/youtube_dl/extractor/mlb.py index 84f500821..42aa2e227 100644 --- a/youtube_dl/extractor/mlb.py +++ b/youtube_dl/extractor/mlb.py @@ -6,12 +6,11 @@ from .common import InfoExtractor from ..utils import ( parse_duration, parse_iso8601, - find_xpath_attr, ) class MLBIE(InfoExtractor): - _VALID_URL = r'http?://m\.mlb\.com/.*video/(?:topic/[\da-z_-]+/)?v(?Pn?\d+)' + _VALID_URL = r'https?://m\.mlb\.com/(?:(?:.*?/)?video/(?:topic/[\da-z_-]+/)?v|shared/video/embed/embed\.html\?.*?\bcontent_id=)(?Pn?\d+)' _TESTS = [ { 'url': 'http://m.mlb.com/sea/video/topic/51231442/v34698933/nymsea-ackley-robs-a-home-run-with-an-amazing-catch/?c_id=sea', @@ -69,6 +68,10 @@ class MLBIE(InfoExtractor): 'thumbnail': 're:^https?://.*\.jpg$', }, }, + { + 'url': 'http://m.mlb.com/shared/video/embed/embed.html?content_id=35692085&topic_id=6479266&width=400&height=224&property=mlb', + 'only_matching': True, + }, ] def _real_extract(self, url): @@ -84,8 +87,9 @@ class MLBIE(InfoExtractor): duration = parse_duration(detail.find('./duration').text) timestamp = parse_iso8601(detail.attrib['date'][:-5]) - thumbnail = find_xpath_attr( - detail, './thumbnailScenarios/thumbnailScenario', 'type', '45').text + thumbnails = [{ + 'url': thumbnail.text, + } for thumbnail in detail.findall('./thumbnailScenarios/thumbnailScenario')] formats = [] for media_url in detail.findall('./url'): @@ -112,5 +116,5 @@ class MLBIE(InfoExtractor): 'duration': duration, 'timestamp': timestamp, 'formats': formats, - 'thumbnail': thumbnail, + 'thumbnails': thumbnails, }