]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cspan.py
a2cbd4d8d592fd2dd6899361a3ab8f4bb3b8a8ed
1 from __future__
import unicode_literals
6 from . common
import InfoExtractor
12 class CSpanIE ( InfoExtractor
):
13 _VALID_URL
= r
'http://www\.c-spanvideo\.org/program/(.*)'
16 'url' : 'http://www.c-spanvideo.org/program/HolderonV' ,
18 'md5' : '8e44ce11f0f725527daccc453f553eb0' ,
20 'title' : 'Attorney General Eric Holder on Voting Rights Act Decision' ,
21 'description' : 'Attorney General Eric Holder spoke to reporters following the Supreme Court decision in [Shelby County v. Holder] in which the court ruled that the preclearance provisions of the Voting Rights Act could not be enforced until Congress established new guidelines for review.' ,
25 def _real_extract ( self
, url
):
26 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
27 prog_name
= mobj
. group ( 1 )
28 webpage
= self
._ download
_ webpage
( url
, prog_name
)
29 video_id
= self
._ search
_ regex
( r
'programid=(.*?)&' , webpage
, 'video id' )
31 title
= self
._ html
_ search
_ regex
(
32 r
'<!-- title -->\n\s*<h1[^>]*>(.*?)</h1>' , webpage
, 'title' )
33 description
= self
._ og
_ search
_ description
( webpage
)
35 info_url
= 'http://c-spanvideo.org/videoLibrary/assets/player/ajax-player.php?os=android&html5=program&id=' + video_id
36 data_json
= self
._ download
_ webpage
(
37 info_url
, video_id
, 'Downloading video info' )
38 data
= json
. loads ( data_json
)
40 url
= unescapeHTML ( data
[ 'video' ][ 'files' ][ 0 ][ 'path' ][ '#text' ])
46 'description' : description
,
47 'thumbnail' : self
._ og
_ search
_ thumbnail
( webpage
),