]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/dreisat.py
24ce794255211112eafadaf2b5a629716b90aa5e
5 from . common
import InfoExtractor
12 class DreiSatIE ( InfoExtractor
):
14 _VALID_URL
= r
'(?:http://)?(?:www\.)?3sat.de/mediathek/index.php\?(?:(?:mode|display)=[^&]+&)*obj=(?P<id>[0-9]+)$'
16 u
"url" : u
"http://www.3sat.de/mediathek/index.php?obj=36983" ,
17 u
'file' : u
'36983.webm' ,
18 u
'md5' : u
'57c97d0469d71cf874f6815aa2b7c944' ,
20 u
"title" : u
"Kaffeeland Schweiz" ,
21 u
"description" : u
"Über 80 Kaffeeröstereien liefern in der Schweiz das Getränk, in das das Land so vernarrt ist: Mehr als 1000 Tassen trinkt ein Schweizer pro Jahr. SCHWEIZWEIT nimmt die Kaffeekultur unter die..." ,
23 u
"upload_date" : u
"20130622"
28 def _real_extract ( self
, url
):
29 mobj
= re
. match ( self
._ VALID
_U RL
, url
)
30 video_id
= mobj
. group ( 'id' )
31 details_url
= 'http://www.3sat.de/mediathek/xmlservice/web/beitragsDetails?ak=web&id= %s ' % video_id
32 details_doc
= self
._ download
_ xml
( details_url
, video_id
, note
= u
'Downloading video details' )
34 thumbnail_els
= details_doc
. findall ( './/teaserimage' )
36 'width' : te
. attrib
[ 'key' ]. partition ( 'x' )[ 0 ],
37 'height' : te
. attrib
[ 'key' ]. partition ( 'x' )[ 2 ],
39 } for te
in thumbnail_els
]
41 information_el
= details_doc
. find ( './/information' )
42 video_title
= information_el
. find ( './title' ). text
43 video_description
= information_el
. find ( './detail' ). text
45 details_el
= details_doc
. find ( './/details' )
46 video_uploader
= details_el
. find ( './channel' ). text
47 upload_date
= unified_strdate ( details_el
. find ( './airtime' ). text
)
49 format_els
= details_doc
. findall ( './/formitaet' )
51 'format_id' : fe
. attrib
[ 'basetype' ],
52 'width' : int ( fe
. find ( './width' ). text
),
53 'height' : int ( fe
. find ( './height' ). text
),
54 'url' : fe
. find ( './url' ). text
,
55 'ext' : determine_ext ( fe
. find ( './url' ). text
),
56 'filesize' : int ( fe
. find ( './filesize' ). text
),
57 'video_bitrate' : int ( fe
. find ( './videoBitrate' ). text
),
58 '3sat_qualityname' : fe
. find ( './quality' ). text
,
59 } for fe
in format_els
60 if not fe
. find ( './url' ). text
. startswith ( 'http://www.metafilegenerator.de/' )]
63 qidx
= [ 'low' , 'med' , 'high' , 'veryhigh' ]. index ( format
[ '3sat_qualityname' ])
64 prefer_http
= 1 if 'rtmp' in format
[ 'url' ] else 0
65 return ( qidx
, prefer_http
, format
[ 'video_bitrate' ])
66 formats
. sort ( key
= _sortkey
)
73 'description' : video_description
,
74 'thumbnails' : thumbnails
,
75 'thumbnail' : thumbnails
[- 1 ][ 'url' ],
76 'uploader' : video_uploader
,
77 'upload_date' : upload_date
,