]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/liveleak.py
0a700d663215df27f3553100862e9805e2c9f6ea
1 from __future__
import unicode_literals
6 from . common
import InfoExtractor
9 class LiveLeakIE ( InfoExtractor
):
10 _VALID_URL
= r
'^(?:http://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
12 'url' : 'http://www.liveleak.com/view?i=757_1364311680' ,
13 'file' : '757_1364311680.mp4' ,
14 'md5' : '0813c2430bea7a46bf13acf3406992f4' ,
16 'description' : 'extremely bad day for this guy..!' ,
17 'uploader' : 'ljfriel2' ,
18 'title' : 'Most unlucky car accident'
22 'url' : 'http://www.liveleak.com/view?i=f93_1390833151' ,
23 'file' : 'f93_1390833151.mp4' ,
24 'md5' : 'd3f1367d14cc3c15bf24fbfbe04b9abf' ,
26 'description' : 'German Television Channel NDR does an exclusive interview with Edward Snowden. \r\n Uploaded on LiveLeak cause German Television thinks the rest of the world isn \' t intereseted in Edward Snowden.' ,
27 'uploader' : 'ARD_Stinkt' ,
28 'title' : 'German Television does first Edward Snowden Interview (ENGLISH)' ,
32 def _real_extract ( self
, url
):
33 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
35 video_id
= mobj
. group ( 'video_id' )
36 webpage
= self
._ download
_ webpage
( url
, video_id
)
37 sources_raw
= self
._ search
_ regex
(
38 r
'(?s)sources:\s*(\[.*?\]),' , webpage
, 'video URLs' , default
= None )
39 if sources_raw
is None :
40 sources_raw
= '[{ %s }]' % (
41 self
._ search
_ regex
( r
'(file: ".*?"),' , webpage
, 'video URL' ))
43 sources_json
= re
. sub ( r
'\s([a-z]+):\s' , r
'"\1": ' , sources_raw
)
44 sources
= json
. loads ( sources_json
)
47 'format_note' : s
. get ( 'label' ),
50 self
._ sort
_ formats
( formats
)
52 video_title
= self
._ og
_ search
_ title
( webpage
). replace ( 'LiveLeak.com -' , '' ). strip ()
53 video_description
= self
._ og
_ search
_ description
( webpage
)
54 video_uploader
= self
._ html
_ search
_ regex
(
55 r
'By:.*?(\w+)</a>' , webpage
, 'uploader' , fatal
= False )
60 'description' : video_description
,
61 'uploader' : video_uploader
,