1 from __future__ import unicode_literals
5 from .common import InfoExtractor
6 from ..utils import find_xpath_attr, compat_str
9 class NBCIE(InfoExtractor):
10 _VALID_URL = r'http://www\.nbc\.com/[^/]+/video/[^/]+/(?P<id>n?\d+)'
13 'url': 'http://www.nbc.com/chicago-fire/video/i-am-a-firefighter/2734188',
14 'md5': '54d0fbc33e0b853a65d7b4de5c06d64e',
18 'title': 'I Am a Firefighter',
19 'description': 'An emergency puts Dawson\'sf irefighter skills to the ultimate test in this four-part digital series.',
23 def _real_extract(self, url):
24 mobj = re.match(self._VALID_URL, url)
25 video_id = mobj.group('id')
26 webpage = self._download_webpage(url, video_id)
27 theplatform_url = self._search_regex('class="video-player video-player-full" data-mpx-url="(.*?)"', webpage, 'theplatform url')
28 if theplatform_url.startswith('//'):
29 theplatform_url = 'http:' + theplatform_url
30 return self.url_result(theplatform_url)
33 class NBCNewsIE(InfoExtractor):
34 _VALID_URL = r'https?://www\.nbcnews\.com/video/.+?/(?P<id>\d+)'
37 'url': 'http://www.nbcnews.com/video/nbc-news/52753292',
38 'md5': '47abaac93c6eaf9ad37ee6c4463a5179',
42 'title': 'Crew emerges after four-month Mars food study',
43 'description': 'md5:24e632ffac72b35f8b67a12d1b6ddfc1',
47 def _real_extract(self, url):
48 mobj = re.match(self._VALID_URL, url)
49 video_id = mobj.group('id')
50 all_info = self._download_xml('http://www.nbcnews.com/id/%s/displaymode/1219' % video_id, video_id)
51 info = all_info.find('video')
55 'title': info.find('headline').text,
57 'url': find_xpath_attr(info, 'media', 'type', 'flashVideo').text,
58 'description': compat_str(info.find('caption').text),
59 'thumbnail': find_xpath_attr(info, 'media', 'type', 'thumbnail').text,