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.

75 lines
2.6 KiB

  1. # coding: utf-8
  2. from __future__ import unicode_literals
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. get_meta_content,
  6. int_or_none,
  7. parse_iso8601,
  8. )
  9. class HeiseIE(InfoExtractor):
  10. _VALID_URL = r'''(?x)
  11. https?://(?:www\.)?heise\.de/video/artikel/
  12. .+?(?P<id>[0-9]+)\.html(?:$|[?#])
  13. '''
  14. _TEST = {
  15. 'url': (
  16. 'http://www.heise.de/video/artikel/Podcast-c-t-uplink-3-3-Owncloud-Tastaturen-Peilsender-Smartphone-2404147.html'
  17. ),
  18. 'md5': 'ffed432483e922e88545ad9f2f15d30e',
  19. 'info_dict': {
  20. 'id': '2404147',
  21. 'ext': 'mp4',
  22. 'title': (
  23. "Podcast: c't uplink 3.3 – Owncloud / Tastaturen / Peilsender Smartphone"
  24. ),
  25. 'format_id': 'mp4_720',
  26. 'timestamp': 1411812600,
  27. 'upload_date': '20140927',
  28. 'description': 'In uplink-Episode 3.3 geht es darum, wie man sich von Cloud-Anbietern emanzipieren kann, worauf man beim Kauf einer Tastatur achten sollte und was Smartphones über uns verraten.',
  29. 'thumbnail': 're:https?://.*\.jpg$',
  30. }
  31. }
  32. def _real_extract(self, url):
  33. video_id = self._match_id(url)
  34. webpage = self._download_webpage(url, video_id)
  35. container_id = self._search_regex(
  36. r'<div class="videoplayerjw".*?data-container="([0-9]+)"',
  37. webpage, 'container ID')
  38. sequenz_id = self._search_regex(
  39. r'<div class="videoplayerjw".*?data-sequenz="([0-9]+)"',
  40. webpage, 'sequenz ID')
  41. data_url = 'http://www.heise.de/videout/feed?container=%s&sequenz=%s' % (container_id, sequenz_id)
  42. doc = self._download_xml(data_url, video_id)
  43. info = {
  44. 'id': video_id,
  45. 'thumbnail': self._og_search_thumbnail(webpage),
  46. 'timestamp': parse_iso8601(get_meta_content('date', webpage)),
  47. 'description': self._og_search_description(webpage),
  48. }
  49. title = get_meta_content('fulltitle', webpage)
  50. if title:
  51. info['title'] = title
  52. else:
  53. info['title'] = self._og_search_title(webpage)
  54. formats = []
  55. for source_node in doc.findall('.//{http://rss.jwpcdn.com/}source'):
  56. label = source_node.attrib['label']
  57. height = int_or_none(self._search_regex(
  58. r'^(.*?_)?([0-9]+)p$', label, 'height', default=None))
  59. formats.append({
  60. 'url': source_node.attrib['file'],
  61. 'format_note': label,
  62. 'height': height,
  63. })
  64. self._sort_formats(formats)
  65. info['formats'] = formats
  66. return info