]>
Raphaƫl G. Git Repositories - youtubedl/blob - youtube_dl/extractor/traileraddict.py
3 from . common
import InfoExtractor
6 class TrailerAddictIE ( InfoExtractor
):
7 _VALID_URL
= r
'(?:http://)?(?:www\.)?traileraddict\.com/trailer/([^/]+)/(?:trailer|feature-trailer)'
9 u
'url' : u
'http://www.traileraddict.com/trailer/prince-avalanche/trailer' ,
10 u
'file' : u
'76184.mp4' ,
11 u
'md5' : u
'41365557f3c8c397d091da510e73ceb4' ,
13 u
"title" : u
"Prince Avalanche Trailer" ,
14 u
"description" : u
"Trailer for Prince Avalanche.Two highway road workers spend the summer of 1988 away from their city lives. The isolated landscape becomes a place of misadventure as the men find themselves at odds with each other and the women they left behind."
18 def _real_extract ( self
, url
):
19 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
20 video_id
= mobj
. group ( 1 )
21 webpage
= self
._ download
_ webpage
( url
, video_id
)
23 title
= self
._ search
_ regex
( r
'<title>(.+?)</title>' ,
24 webpage
, 'video title' ). replace ( ' - Trailer Addict' , '' )
25 view_count
= self
._ search
_ regex
( r
'Views: (.+?)<br />' ,
26 webpage
, 'Views Count' )
27 description
= self
._ search
_ regex
( r
'<meta property="og:description" content="(.+?)" />' ,
28 webpage
, 'video description' )
29 video_id
= self
._ search
_ regex
( r
'<meta property="og:video" content="(.+?)" />' ,
30 webpage
, 'Video id' ). split ( '=' )[ 1 ]
32 info_url
= "http://www.traileraddict.com/fvar.php?tid= %s " %( str ( video_id
))
33 info_webpage
= self
._ download
_ webpage
( info_url
, video_id
, "Downloading the info webpage" )
35 final_url
= self
._ search
_ regex
( r
'&fileurl=(.+)' ,
36 info_webpage
, 'Download url' ). replace ( '%3F' , '?' )
37 thumbnail_url
= self
._ search
_ regex
( r
'&image=(.+?)&' ,
38 info_webpage
, 'thumbnail url' )
39 ext
= final_url
. split ( '.' )[- 1 ]. split ( '?' )[ 0 ]
46 'thumbnail' : thumbnail_url
,
47 'description' : description
,
48 'view_count' : view_count
,