]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/ndr.py
79a13958b05e25a1c9e586168bb3a10742fbe01f
2 from __future__
import unicode_literals
6 from . common
import InfoExtractor
15 class NDRBaseIE ( InfoExtractor
):
16 def _real_extract ( self
, url
):
17 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
18 video_id
= mobj
. group ( 'id' )
20 page
= self
._ download
_ webpage
( url
, video_id
, 'Downloading page' )
22 title
= self
._ og
_ search
_ title
( page
). strip ()
23 description
= self
._ og
_ search
_ description
( page
)
25 description
= description
. strip ()
27 duration
= int_or_none ( self
._ html
_ search
_ regex
( r
'duration: (\d+),\n' , page
, 'duration' , default
= None ))
29 duration
= parse_duration ( self
._ html
_ search
_ regex
(
30 r
'(<span class="min">\d+</span>:<span class="sec">\d+</span>)' ,
31 page
, 'duration' , default
= None ))
35 mp3_url
= re
. search ( r
'''\{src:'(?P<audio>[^']+)', type:"audio/mp3"},''' , page
)
38 'url' : mp3_url
. group ( 'audio' ),
44 video_url
= re
. search ( r
'''3: \{src:'(?P<video>.+?)\.(lo|hi|hq)\.mp4', type:"video/mp4"},''' , page
)
46 thumbnails
= re
. findall ( r
'''\d+: \{src: "([^"]+)"(?: \|\| '[^']+')?, quality: '([^']+)'}''' , page
)
48 quality_key
= qualities ([ 'xs' , 's' , 'm' , 'l' , 'xl' ])
49 largest
= max ( thumbnails
, key
= lambda thumb
: quality_key ( thumb
[ 1 ]))
50 thumbnail
= 'http://www.ndr.de' + largest
[ 0 ]
52 for format_id
in 'lo' , 'hi' , 'hq' :
54 'url' : ' %s . %s .mp4' % ( video_url
. group ( 'video' ), format_id
),
55 'format_id' : format_id
,
59 raise ExtractorError ( 'No media links available for %s ' % video_id
)
64 'description' : description
,
65 'thumbnail' : thumbnail
,
71 class NDRIE ( NDRBaseIE
):
73 IE_DESC
= 'NDR.de - Mediathek'
74 _VALID_URL
= r
'https?://www\.ndr\.de/.+?(?P<id>\d+)\.html'
78 'url' : 'http://www.ndr.de/fernsehen/sendungen/nordmagazin/Kartoffeltage-in-der-Lewitz,nordmagazin25866.html' ,
79 'md5' : '5bc5f5b92c82c0f8b26cddca34f8bb2c' ,
84 'title' : 'Kartoffeltage in der Lewitz' ,
85 'description' : 'md5:48c4c04dde604c8a9971b3d4e3b9eaa8' ,
88 'skip' : '404 Not found' ,
91 'url' : 'http://www.ndr.de/fernsehen/Party-Poette-und-Parade,hafengeburtstag988.html' ,
92 'md5' : 'dadc003c55ae12a5d2f6bd436cd73f59' ,
96 'title' : 'Party, Pötte und Parade' ,
97 'description' : 'Hunderttausende feiern zwischen Speicherstadt und St. Pauli den 826. Hafengeburtstag. Die NDR Sondersendung zeigt die schönsten und spektakulärsten Bilder vom Auftakt.' ,
102 'url' : 'http://www.ndr.de/info/audio51535.html' ,
103 'md5' : 'bb3cd38e24fbcc866d13b50ca59307b8' ,
104 'note' : 'Audio file' ,
108 'title' : 'La Valette entgeht der Hinrichtung' ,
109 'description' : 'md5:22f9541913a40fe50091d5cdd7c9f536' ,
116 class NJoyIE ( NDRBaseIE
):
118 _VALID_URL
= r
'https?://www\.n-joy\.de/.+?(?P<id>\d+)\.html'
121 'url' : 'http://www.n-joy.de/entertainment/comedy/comedy_contest/Benaissa-beim-NDR-Comedy-Contest,comedycontest2480.html' ,
122 'md5' : 'cb63be60cd6f9dd75218803146d8dc67' ,
126 'title' : 'Benaissa beim NDR Comedy Contest' ,
127 'description' : 'Von seinem sehr "behaarten" Leben lässt sich Benaissa trotz aller Schwierigkeiten nicht unterkriegen.' ,