]>
jfr.im git - yt-dlp.git/blob - yt_dlp/extractor/traileraddict.py
1 from __future__
import unicode_literals
5 from . common
import InfoExtractor
8 class TrailerAddictIE ( InfoExtractor
):
10 _VALID_URL
= r
'(?:https?://)?(?:www\.)?traileraddict\.com/(?:trailer|clip)/(?P<movie>.+?)/(?P<trailer_name>.+)'
12 'url' : 'http://www.traileraddict.com/trailer/prince-avalanche/trailer' ,
13 'md5' : '41365557f3c8c397d091da510e73ceb4' ,
17 'title' : 'Prince Avalanche Trailer' ,
18 'description' : 'Trailer for Prince Avalanche. \n\n 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.' ,
22 def _real_extract ( self
, url
):
23 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
24 name
= mobj
. group ( 'movie' ) + '/' + mobj
. group ( 'trailer_name' )
25 webpage
= self
._ download
_ webpage
( url
, name
)
27 title
= self
._ search
_ regex
( r
'<title>(.+?)</title>' ,
28 webpage
, 'video title' ). replace ( ' - Trailer Addict' , '' )
29 view_count_str
= self
._ search
_ regex
(
30 r
'<span class="views_n">([0-9,.]+)</span>' ,
31 webpage
, 'view count' , fatal
= False )
33 None if view_count_str
is None
34 else int ( view_count_str
. replace ( ',' , '' )))
35 video_id
= self
._ search
_ regex
(
36 r
'<param\s+name="movie"\s+value="/emb/([0-9]+)"\s*/>' ,
39 # Presence of (no)watchplus function indicates HD quality is available
40 if re
. search ( r
'function (no)?watchplus()' , webpage
):
45 info_url
= 'http://www.traileraddict.com/ %s .php?tid= %s ' % ( fvar
, str ( video_id
))
46 info_webpage
= self
._ download
_ webpage
( info_url
, video_id
, 'Downloading the info webpage' )
48 final_url
= self
._ search
_ regex
( r
'&fileurl=(.+)' ,
49 info_webpage
, 'Download url' ). replace ( '%3F' , '?' )
50 thumbnail_url
= self
._ search
_ regex
( r
'&image=(.+?)&' ,
51 info_webpage
, 'thumbnail url' )
53 description
= self
._ html
_ search
_ regex
(
54 r
'(?s)<div class="synopsis">.*?<div class="movie_label_info"[^>]*>(.*?)</div>' ,
55 webpage
, 'description' , fatal
= False )
61 'thumbnail' : thumbnail_url
,
62 'description' : description
,
63 'view_count' : view_count
,