]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/karrierevideos.py
c05263e6165159320376939c252af7dea7aeadb2
   2 from __future__ 
import unicode_literals
 
   4 from .common 
import InfoExtractor
 
   5 from ..compat 
import compat_urlparse
 
  14 class KarriereVideosIE(InfoExtractor
): 
  15     _VALID_URL 
= r
'https?://(?:www\.)?karrierevideos\.at(?:/[^/]+)+/(?P<id>[^/]+)' 
  17         'url': 'http://www.karrierevideos.at/berufsvideos/mittlere-hoehere-schulen/altenpflegerin', 
  21             'title': 'AltenpflegerIn', 
  22             'description': 'md5:dbadd1259fde2159a9b28667cb664ae2', 
  23             'thumbnail': 're:^http://.*\.png', 
  27             'skip_download': True, 
  31         'url': 'http://www.karrierevideos.at/orientierung/vaeterkarenz-und-neue-chancen-fuer-muetter-baby-was-nun', 
  35             'title': 'Väterkarenz und neue Chancen für Mütter - "Baby - was nun?"', 
  36             'description': 'md5:97092c6ad1fd7d38e9d6a5fdeb2bcc33', 
  37             'thumbnail': 're:^http://.*\.png', 
  41             'skip_download': True, 
  45     def _real_extract(self
, url
): 
  46         video_id 
= self
._match
_id
(url
) 
  48         webpage 
= self
._download
_webpage
(url
, video_id
) 
  50         title 
= (self
._html
_search
_meta
('title', webpage
, default
=None) or 
  51                  self
._search
_regex
(r
'<h1 class="title">([^<]+)</h1>')) 
  53         video_id 
= self
._search
_regex
( 
  54             r
'/config/video/(.+?)\.xml', webpage
, 'video id') 
  55         # Server returns malformed headers 
  56         # Force Accept-Encoding: * to prevent gzipped results 
  57         playlist 
= self
._download
_xml
( 
  58             'http://www.karrierevideos.at/player-playlist.xml.php?p=%s' % video_id
, 
  59             video_id
, transform_source
=fix_xml_ampersands
, 
  60             headers
={'Accept-Encoding': '*'}) 
  63             'jwplayer': 'http://developer.longtailvideo.com/trac/wiki/FlashFormats' 
  67             return xpath_with_ns(path
, NS_MAP
) 
  69         item 
= playlist
.find('./tracklist/item') 
  70         video_file 
= xpath_text( 
  71             item
, ns('./jwplayer:file'), 'video url', fatal
=True) 
  72         streamer 
= xpath_text( 
  73             item
, ns('./jwplayer:streamer'), 'streamer', fatal
=True) 
  75         uploader 
= xpath_text( 
  76             item
, ns('./jwplayer:author'), 'uploader') 
  77         duration 
= float_or_none( 
  78             xpath_text(item
, ns('./jwplayer:duration'), 'duration')) 
  80         description 
= self
._html
_search
_regex
( 
  81             r
'(?s)<div class="leadtext">(.+?)</div>', 
  82             webpage
, 'description') 
  84         thumbnail 
= self
._html
_search
_meta
( 
  85             'thumbnail', webpage
, 'thumbnail') 
  87             thumbnail 
= compat_urlparse
.urljoin(url
, thumbnail
) 
  91             'url': streamer
.replace('rtmpt', 'rtmp'), 
  92             'play_path': 'mp4:%s' % video_file
, 
  95             'description': description
, 
  96             'thumbnail': thumbnail
,