]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/twentymin.py
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
7 from .. utils
import remove_end
10 class TwentyMinutenIE ( InfoExtractor
):
12 _VALID_URL
= r
'https?://(?:www\.)?20min\.ch/(?:videotv/*\?.*\bvid=(?P<id>\d+)|(?:[^/]+/)*(?P<display_id>[^/#?]+))'
15 'url' : 'http://www.20min.ch/videotv/?vid=469148&cid=2' ,
16 'md5' : 'b52d6bc6ea6398e6a38f12cfd418149c' ,
20 'title' : '85 000 Franken für 15 perfekte Minuten' ,
21 'description' : 'Was die Besucher vom Silvesterzauber erwarten können. (Video: Alice Grosjean/Murat Temel)' ,
22 'thumbnail' : 'http://thumbnails.20min-tv.ch/server063/469148/frame-72-469148.jpg'
25 # news article with video
26 'url' : 'http://www.20min.ch/schweiz/news/story/-Wir-muessen-mutig-nach-vorne-schauen--22050469' ,
27 'md5' : 'cd4cbb99b94130cff423e967cd275e5e' ,
30 'display_id' : '-Wir-muessen-mutig-nach-vorne-schauen--22050469' ,
32 'title' : '«Wir müssen mutig nach vorne schauen»' ,
33 'description' : 'Kein Land sei innovativer als die Schweiz, sagte Johann Schneider-Ammann in seiner Neujahrsansprache. Das Land müsse aber seine Hausaufgaben machen.' ,
34 'thumbnail' : 'http://www.20min.ch/images/content/2/2/0/22050469/10/teaserbreit.jpg'
37 'url' : 'http://www.20min.ch/videotv/?cid=44&vid=468738' ,
38 'only_matching' : True ,
40 'url' : 'http://www.20min.ch/ro/sortir/cinema/story/Grandir-au-bahut--c-est-dur-18927411' ,
41 'only_matching' : True ,
44 def _real_extract ( self
, url
):
45 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
46 video_id
= mobj
. group ( 'id' )
47 display_id
= mobj
. group ( 'display_id' ) or video_id
49 webpage
= self
._ download
_ webpage
( url
, display_id
)
51 title
= self
._ html
_ search
_ regex
(
52 r
'<h1>.*?<span>(.+?)</span></h1>' ,
53 webpage
, 'title' , default
= None )
55 title
= remove_end ( re
. sub (
56 r
'^20 [Mm]inuten.*? -' , '' , self
._ og
_ search
_ title
( webpage
)), ' - News' )
59 video_id
= self
._ search
_ regex
(
60 r
'"file\d?"\s*,\s*\"(\d+)' , webpage
, 'video id' )
62 description
= self
._ html
_ search
_ meta
(
63 'description' , webpage
, 'description' )
64 thumbnail
= self
._ og
_ search
_ thumbnail
( webpage
)
68 'display_id' : display_id
,
69 'url' : 'http://speed.20min-tv.ch/ %s m.flv' % video_id
,
71 'description' : description
,
72 'thumbnail' : thumbnail
,