]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/cspan.py
d65046f588d0bf4481ec6f8d8de7e031e6bdb2f9
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
12 class CSpanIE ( InfoExtractor
):
13 _VALID_URL
= r
'http://(?:www\.)?c-span\.org/video/\?(?P<id>\d+)'
16 'url' : 'http://www.c-span.org/video/?313572-1/HolderonV' ,
17 'md5' : '8e44ce11f0f725527daccc453f553eb0' ,
21 'title' : 'Attorney General Eric Holder on Voting Rights Act Decision' ,
22 '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.' ,
24 'skip' : 'Regularly fails on travis, for unknown reasons' ,
27 def _real_extract ( self
, url
):
28 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
29 page_id
= mobj
. group ( 'id' )
30 webpage
= self
._ download
_ webpage
( url
, page_id
)
31 video_id
= self
._ search
_ regex
( r
'data-progid=\' ( \d
+) \' > ', webpage, ' video
id ')
33 description = self._html_search_regex(
35 # The full description
36 r' < div
class = \' expandable
\' >(.* ?
)< a href
= \' #\'',
37 # If the description is small enough the other div is not
38 # present, otherwise this is a stripped version
39 r
'<p class=\' initial
\' >(.* ?
)</ p
> '
41 webpage, ' description
', flags=re.DOTALL)
43 info_url = ' http
:// c
- spanvideo
. org
/ videoLibrary
/ assets
/ player
/ ajax
- player
. php?os
= android
& html5
= program
& id = ' + video_id
44 data = self._download_json(info_url, video_id)
46 url = unescapeHTML(data[' video
'][' files
'][0][' path
'][' #text'])
48 doc
= self
._ download
_ xml
( 'http://www.c-span.org/common/services/flashXml.php?programid=' + video_id
,
52 return find_xpath_attr ( doc
, './/string' , 'name' , s
). text
56 'title' : find_string ( 'title' ),
58 'description' : description
,
59 'thumbnail' : find_string ( 'poster' ),