]>
jfr.im git - yt-dlp.git/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
'https?://(?:\w+\.)?liveleak\.com/view\?(?:.*?)i=(?P<id>[\w_]+)(?:.*)'
13 'url' : 'http://www.liveleak.com/view?i=757_1364311680' ,
14 'md5' : '50f79e05ba149149c1b4ea961223d5b3' ,
16 'id' : '757_1364311680' ,
18 'description' : 'extremely bad day for this guy..!' ,
19 'uploader' : 'ljfriel2' ,
20 'title' : 'Most unlucky car accident' ,
21 'thumbnail' : 're:^https?://.*\.jpg$'
24 'url' : 'http://www.liveleak.com/view?i=f93_1390833151' ,
25 'md5' : 'b13a29626183c9d33944e6a04f41aafc' ,
27 'id' : 'f93_1390833151' ,
29 '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.' ,
30 'uploader' : 'ARD_Stinkt' ,
31 'title' : 'German Television does first Edward Snowden Interview (ENGLISH)' ,
32 'thumbnail' : 're:^https?://.*\.jpg$'
35 'url' : 'http://www.liveleak.com/view?i=4f7_1392687779' ,
36 'md5' : '42c6d97d54f1db107958760788c5f48f' ,
38 'id' : '4f7_1392687779' ,
40 '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." ,
41 'uploader' : 'CapObveus' ,
42 'title' : 'Man is Fatally Struck by Reckless Car While Packing up a Moving Truck' ,
46 # Covers https://github.com/rg3/youtube-dl/pull/5983
47 'url' : 'http://www.liveleak.com/view?i=801_1409392012' ,
48 'md5' : '0b3bec2d888c20728ca2ad3642f0ef15' ,
50 'id' : '801_1409392012' ,
52 'description' : 'Happened on 27.7.2014. \r\n At 0:53 you can see people still swimming at near beach.' ,
53 'uploader' : 'bony333' ,
54 'title' : 'Crazy Hungarian tourist films close call waterspout in Croatia' ,
55 'thumbnail' : 're:^https?://.*\.jpg$'
58 # Covers https://github.com/rg3/youtube-dl/pull/10664#issuecomment-247439521
59 'url' : 'http://m.liveleak.com/view?i=763_1473349649' ,
60 'add_ie' : [ 'Youtube' ],
62 'id' : '763_1473349649' ,
64 'title' : 'Reporters and public officials ignore epidemic of black on asian violence in Sacramento | Colin Flaherty' ,
65 'description' : 'Colin being the warrior he is and showing the injustice Asians in Sacramento are being subjected to.' ,
67 'upload_date' : '20160908' ,
68 'uploader_id' : 'UCEbta5E_jqlZmEJsriTEtnw'
73 def _extract_url ( webpage
):
75 r
'<iframe[^>]+src="https?://(?:\w+\.)?liveleak\.com/ll_embed\?(?:.*?)i=(?P<id>[\w_]+)(?:.*)' ,
78 return 'http://www.liveleak.com/view?i= %s ' % mobj
. group ( 'id' )
80 def _real_extract ( self
, url
):
81 video_id
= self
._ match
_ id
( url
)
82 webpage
= self
._ download
_ webpage
( url
, video_id
)
84 video_title
= self
._ og
_ search
_ title
( webpage
). replace ( 'LiveLeak.com -' , '' ). strip ()
85 video_description
= self
._ og
_ search
_ description
( webpage
)
86 video_uploader
= self
._ html
_ search
_ regex
(
87 r
'By:.*?(\w+)</a>' , webpage
, 'uploader' , fatal
= False )
88 age_limit
= int_or_none ( self
._ search
_ regex
(
89 r
'you confirm that you are ([0-9]+) years and over.' ,
90 webpage
, 'age limit' , default
= None ))
91 video_thumbnail
= self
._ og
_ search
_ thumbnail
( webpage
)
93 sources_raw
= self
._ search
_ regex
(
94 r
'(?s)sources:\s*(\[.*?\]),' , webpage
, 'video URLs' , default
= None )
95 if sources_raw
is None :
96 alt_source
= self
._ search
_ regex
(
97 r
'(file: ".*?"),' , webpage
, 'video URL' , default
= None )
99 sources_raw
= '[ { %s} ]' % alt_source
102 embed_url
= self
._ search
_ regex
(
103 r
'<iframe[^>]+src="((?:(?:http://www.prochan.com/embed\?)|(?:http://www.youtube.com/embed))[^"]+)"' ,
104 webpage
, 'embed URL' )
106 '_type' : 'url_transparent' ,
109 'title' : video_title
,
110 'description' : video_description
,
111 'uploader' : video_uploader
,
112 'age_limit' : age_limit
,
115 sources_json
= re
. sub ( r
'\s([a-z]+):\s' , r
'"\1": ' , sources_raw
)
116 sources
= json
. loads ( sources_json
)
119 'format_id' : ' %s ' % i
,
120 'format_note' : s
. get ( 'label' ),
122 } for i
, s
in enumerate ( sources
)]
124 for i
, s
in enumerate ( sources
):
125 # Removing '.h264_*.mp4' gives the raw video, which is essentially
126 # the same video without the LiveLeak logo at the top (see
127 # https://github.com/rg3/youtube-dl/pull/4768)
128 orig_url
= re
. sub ( r
'\.h264_.+?\.mp4' , '' , s
[ 'file' ])
129 if s
[ 'file' ] != orig_url
:
131 'format_id' : 'original- %s ' % i
,
132 'format_note' : s
. get ( 'label' ),
136 self
._ sort
_ formats
( formats
)
140 'title' : video_title
,
141 'description' : video_description
,
142 'uploader' : video_uploader
,
144 'age_limit' : age_limit
,
145 'thumbnail' : video_thumbnail
,