]>
jfr.im git - yt-dlp.git/blob - youtube_dl/extractor/cspan.py
3 from .common
import InfoExtractor
8 class CSpanIE(InfoExtractor
):
9 _VALID_URL
= r
'http://www\.c-spanvideo\.org/program/(.*)'
11 u
'url': u
'http://www.c-spanvideo.org/program/HolderonV',
12 u
'file': u
'315139.flv',
13 u
'md5': u
'74a623266956f69e4df0068ab6c80fe4',
15 u
"title": u
"Attorney General Eric Holder on Voting Rights Act Decision"
17 u
'skip': u
'Requires rtmpdump'
20 def _real_extract(self
, url
):
21 mobj
= re
.match(self
._VALID
_URL
, url
)
22 prog_name
= mobj
.group(1)
23 webpage
= self
._download
_webpage
(url
, prog_name
)
24 video_id
= self
._search
_regex
(r
'programid=(.*?)&', webpage
, 'video id')
25 data
= compat_urllib_parse
.urlencode({'programid': video_id
,
27 info_url
= 'http://www.c-spanvideo.org/common/services/flashXml.php?' + data
28 video_info
= self
._download
_webpage
(info_url
, video_id
, u
'Downloading video info')
30 self
.report_extraction(video_id
)
32 title
= self
._html
_search
_regex
(r
'<string name="title">(.*?)</string>',
34 description
= self
._html
_search
_regex
(r
'<meta (?:property="og:|name=")description" content="(.*?)"',
35 webpage
, 'description',
36 flags
=re
.MULTILINE|re
.DOTALL
)
38 url
= self
._search
_regex
(r
'<string name="URL">(.*?)</string>',
39 video_info
, 'video url')
40 url
= url
.replace('$(protocol)', 'rtmp').replace('$(port)', '443')
41 path
= self
._search
_regex
(r
'<string name="path">(.*?)</string>',
42 video_info
, 'rtmp play path')
44 return {'id': video_id
,
49 'description': description
,
50 'thumbnail': self
._og
_search
_thumbnail
(webpage
),