]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/liveleak.py
1 from __future__
import unicode_literals
6 from . common
import InfoExtractor
7 from .. utils
import int_or_none
10 class LiveLeakIE ( InfoExtractor
):
11 _VALID_URL
= r
'^(?:http://)?(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<video_id>[\w_]+)(?:.*)'
13 'url' : 'http://www.liveleak.com/view?i=757_1364311680' ,
14 'md5' : '0813c2430bea7a46bf13acf3406992f4' ,
16 'id' : '757_1364311680' ,
18 'description' : 'extremely bad day for this guy..!' ,
19 'uploader' : 'ljfriel2' ,
20 'title' : 'Most unlucky car accident'
23 'url' : 'http://www.liveleak.com/view?i=f93_1390833151' ,
24 'md5' : 'd3f1367d14cc3c15bf24fbfbe04b9abf' ,
26 'id' : 'f93_1390833151' ,
28 '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.' ,
29 'uploader' : 'ARD_Stinkt' ,
30 'title' : 'German Television does first Edward Snowden Interview (ENGLISH)' ,
33 'url' : 'http://www.liveleak.com/view?i=4f7_1392687779' ,
34 'md5' : '42c6d97d54f1db107958760788c5f48f' ,
36 'id' : '4f7_1392687779' ,
38 'description' : "The guy with the cigarette seems amazingly nonchalant about the whole thing... I really hope my friends' reactions would be a bit stronger. \r\n\r\n Action-go to 0:55." ,
39 'uploader' : 'CapObveus' ,
40 'title' : 'Man is Fatally Struck by Reckless Car While Packing up a Moving Truck' ,
45 def _real_extract ( self
, url
):
46 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
47 video_id
= mobj
. group ( 'video_id' )
48 webpage
= self
._ download
_ webpage
( url
, video_id
)
50 video_title
= self
._ og
_ search
_ title
( webpage
). replace ( 'LiveLeak.com -' , '' ). strip ()
51 video_description
= self
._ og
_ search
_ description
( webpage
)
52 video_uploader
= self
._ html
_ search
_ regex
(
53 r
'By:.*?(\w+)</a>' , webpage
, 'uploader' , fatal
= False )
54 age_limit
= int_or_none ( self
._ search
_ regex
(
55 r
'you confirm that you are ([0-9]+) years and over.' ,
56 webpage
, 'age limit' , default
= None ))
58 sources_raw
= self
._ search
_ regex
(
59 r
'(?s)sources:\s*(\[.*?\]),' , webpage
, 'video URLs' , default
= None )
60 if sources_raw
is None :
61 alt_source
= self
._ search
_ regex
(
62 r
'(file: ".*?"),' , webpage
, 'video URL' , default
= None )
64 sources_raw
= '[{ %s }]' % alt_source
67 embed_url
= self
._ search
_ regex
(
68 r
'<iframe[^>]+src="(http://www.prochan.com/embed\?[^"]+)"' ,
71 '_type' : 'url_transparent' ,
75 'description' : video_description
,
76 'uploader' : video_uploader
,
77 'age_limit' : age_limit
,
80 sources_json
= re
. sub ( r
'\s([a-z]+):\s' , r
'"\1": ' , sources_raw
)
81 sources
= json
. loads ( sources_json
)
84 'format_note' : s
. get ( 'label' ),
87 self
._ sort
_ formats
( formats
)
92 'description' : video_description
,
93 'uploader' : video_uploader
,
95 'age_limit' : age_limit
,