]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/nbc.py
2 import xml
.etree
.ElementTree
4 from .common
import InfoExtractor
5 from ..utils
import find_xpath_attr
, compat_str
8 class NBCNewsIE(InfoExtractor
):
9 _VALID_URL
= r
'https?://www\.nbcnews\.com/video/.+?/(?P<id>\d+)'
12 u
'url': u
'http://www.nbcnews.com/video/nbc-news/52753292',
13 u
'file': u
'52753292.flv',
14 u
'md5': u
'47abaac93c6eaf9ad37ee6c4463a5179',
16 u
'title': u
'Crew emerges after four-month Mars food study',
17 u
'description': u
'md5:24e632ffac72b35f8b67a12d1b6ddfc1',
21 def _real_extract(self
, url
):
22 mobj
= re
.match(self
._VALID
_URL
, url
)
23 video_id
= mobj
.group('id')
24 info_xml
= self
._download
_webpage
('http://www.nbcnews.com/id/%s/displaymode/1219' % video_id
, video_id
)
25 info
= xml
.etree
.ElementTree
.fromstring(info_xml
.encode('utf-8')).find('video')
27 return {'id': video_id
,
28 'title': info
.find('headline').text
,
30 'url': find_xpath_attr(info
, 'media', 'type', 'flashVideo').text
,
31 'description': compat_str(info
.find('caption').text
),
32 'thumbnail': find_xpath_attr(info
, 'media', 'type', 'thumbnail').text
,