]>
Raphaël G. Git Repositories - youtubedl/blob - youtube_dl/extractor/faz.py
89ed08db4cbb99f9381013813fa03a19474c8e24
   3 import xml
.etree
.ElementTree
 
   5 from .common 
import InfoExtractor
 
  11 class FazIE(InfoExtractor
): 
  13     _VALID_URL 
= r
'https?://www\.faz\.net/multimedia/videos/.*?-(?P<id>\d+).html' 
  16         u
'url': u
'http://www.faz.net/multimedia/videos/stockholm-chemie-nobelpreis-fuer-drei-amerikanische-forscher-12610585.html', 
  17         u
'file': u
'12610585.mp4', 
  19             u
'title': u
'Stockholm: Chemie-Nobelpreis für drei amerikanische Forscher', 
  20             u
'description': u
'md5:1453fbf9a0d041d985a47306192ea253', 
  24     def _real_extract(self
, url
): 
  25         mobj 
= re
.match(self
._VALID
_URL
, url
) 
  26         video_id 
= mobj
.group('id') 
  27         self
.to_screen(video_id
) 
  28         webpage 
= self
._download
_webpage
(url
, video_id
) 
  29         config_xml_url 
= self
._search
_regex
(r
'writeFLV\(\'(.+?
)\',', webpage, 
  31         config_xml = self._download_webpage(config_xml_url, video_id, 
  32             u'Downloading config xml
') 
  33         config = xml.etree.ElementTree.fromstring(config_xml.encode('utf
-8')) 
  35         encodings = config.find('ENCODINGS
') 
  37         for code in ['LOW
', 'HIGH
', 'HQ
']: 
  38             encoding = encodings.find(code) 
  41             encoding_url = encoding.find('FILENAME
').text 
  44                 'ext
': determine_ext(encoding_url), 
  45                 'format_id
': code.lower(), 
  48         descr = self._html_search_regex(r'<p 
class="Content Copy">(.*?
)</p
>', webpage, u'description
') 
  51             'title
': self._og_search_title(webpage), 
  54             'thumbnail
': config.find('STILL
/STILL_BIG
').text, 
  56         # TODO: Remove when #980 has been merged 
  57         info.update(formats[-1])