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.

40 lines
1.3 KiB

10 years ago
9 years ago
  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. int_or_none,
  6. unescapeHTML,
  7. )
  8. class BildIE(InfoExtractor):
  9. _VALID_URL = r'https?://(?:www\.)?bild\.de/(?:[^/]+/)+(?P<display_id>[^/]+)-(?P<id>\d+)(?:,auto=true)?\.bild\.html'
  10. IE_DESC = 'Bild.de'
  11. _TEST = {
  12. 'url': 'http://www.bild.de/video/clip/apple-ipad-air/das-koennen-die-neuen-ipads-38184146.bild.html',
  13. 'md5': 'dd495cbd99f2413502a1713a1156ac8a',
  14. 'info_dict': {
  15. 'id': '38184146',
  16. 'ext': 'mp4',
  17. 'title': 'Das können die neuen iPads',
  18. 'description': 'md5:a4058c4fa2a804ab59c00d7244bbf62f',
  19. 'thumbnail': 're:^https?://.*\.jpg$',
  20. 'duration': 196,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. video_id = self._match_id(url)
  25. video_data = self._download_json(
  26. url.split('.bild.html')[0] + ',view=json.bild.html', video_id)
  27. return {
  28. 'id': video_id,
  29. 'title': unescapeHTML(video_data['title']).strip(),
  30. 'description': unescapeHTML(video_data.get('description')),
  31. 'url': video_data['clipList'][0]['srces'][0]['src'],
  32. 'thumbnail': video_data.get('poster'),
  33. 'duration': int_or_none(video_data.get('durationSec')),
  34. }