You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.4 KiB

10 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import int_or_none
  5. class BildIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?bild\.de/(?:[^/]+/)+(?P<display_id>[^/]+)-(?P<id>\d+)(?:,auto=true)?\.bild\.html'
  7. IE_DESC = 'Bild.de'
  8. _TEST = {
  9. 'url': 'http://www.bild.de/video/clip/apple-ipad-air/das-koennen-die-neuen-ipads-38184146.bild.html',
  10. 'md5': 'dd495cbd99f2413502a1713a1156ac8a',
  11. 'info_dict': {
  12. 'id': '38184146',
  13. 'ext': 'mp4',
  14. 'title': 'BILD hat sie getestet',
  15. 'thumbnail': 'http://bilder.bild.de/fotos/stand-das-koennen-die-neuen-ipads-38184138/Bild/1.bild.jpg',
  16. 'duration': 196,
  17. 'description': 'Mit dem iPad Air 2 und dem iPad Mini 3 hat Apple zwei neue Tablet-Modelle präsentiert. BILD-Reporter Sven Stein durfte die Geräte bereits testen. ',
  18. }
  19. }
  20. def _real_extract(self, url):
  21. video_id = self._match_id(url)
  22. xml_url = url.split(".bild.html")[0] + ",view=xml.bild.xml"
  23. doc = self._download_xml(xml_url, video_id)
  24. duration = int_or_none(doc.attrib.get('duration'), scale=1000)
  25. return {
  26. 'id': video_id,
  27. 'title': doc.attrib['ueberschrift'],
  28. 'description': doc.attrib.get('text'),
  29. 'url': doc.attrib['src'],
  30. 'thumbnail': doc.attrib.get('img'),
  31. 'duration': duration,
  32. }