]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cspan.py
2246515f2a9205da9a329a78343b759e460bf3df
3 from .common
import InfoExtractor
8 class CSpanIE(InfoExtractor
):
9 _VALID_URL
= r
'http://www.c-spanvideo.org/program/(.*)'
11 def _real_extract(self
, url
):
12 mobj
= re
.match(self
._VALID
_URL
, url
)
13 prog_name
= mobj
.group(1)
14 webpage
= self
._download
_webpage
(url
, prog_name
)
15 video_id
= self
._search
_regex
(r
'programid=(.*?)&', webpage
, 'video id')
16 data
= compat_urllib_parse
.urlencode({'programid': video_id
,
18 info_url
= 'http://www.c-spanvideo.org/common/services/flashXml.php?' + data
19 video_info
= self
._download
_webpage
(info_url
, video_id
, u
'Downloading video info')
21 self
.report_extraction(video_id
)
23 title
= self
._html
_search
_regex
(r
'<string name="title">(.*?)</string>',
25 description
= self
._html
_search
_regex
(r
'<meta (?:property="og:|name=")description" content="(.*?)"',
26 webpage
, 'description',
27 flags
=re
.MULTILINE|re
.DOTALL
)
28 thumbnail
= self
._html
_search
_regex
(r
'<meta property="og:image" content="(.*?)"',
31 url
= self
._search
_regex
(r
'<string name="URL">(.*?)</string>',
32 video_info
, 'video url')
33 url
= url
.replace('$(protocol)', 'rtmp').replace('$(port)', '443')
34 path
= self
._search
_regex
(r
'<string name="path">(.*?)</string>',
35 video_info
, 'rtmp play path')
37 return {'id': video_id
,
42 'description': description
,
43 'thumbnail': thumbnail
,