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.

53 lines
1.7 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import unified_strdate
  5. class TeleTaskIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?tele-task\.de/archive/video/html5/(?P<id>[0-9]+)'
  7. _TEST = {
  8. 'url': 'http://www.tele-task.de/archive/video/html5/26168/',
  9. 'info_dict': {
  10. 'title': 'Duplicate Detection',
  11. },
  12. 'playlist': [{
  13. 'md5': '290ef69fb2792e481169c3958dbfbd57',
  14. 'info_dict': {
  15. 'id': '26168-speaker',
  16. 'ext': 'mp4',
  17. 'title': 'Duplicate Detection',
  18. 'upload_date': '20141218',
  19. }
  20. }, {
  21. 'md5': 'e1e7218c5f0e4790015a437fcf6c71b4',
  22. 'info_dict': {
  23. 'id': '26168-slides',
  24. 'ext': 'mp4',
  25. 'title': 'Duplicate Detection',
  26. 'upload_date': '20141218',
  27. }
  28. }]
  29. }
  30. def _real_extract(self, url):
  31. lecture_id = self._match_id(url)
  32. webpage = self._download_webpage(url, lecture_id)
  33. title = self._html_search_regex(
  34. r'itemprop="name">([^<]+)</a>', webpage, 'title')
  35. upload_date = unified_strdate(self._html_search_regex(
  36. r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False))
  37. entries = [{
  38. 'id': '%s-%s' % (lecture_id, format_id),
  39. 'url': video_url,
  40. 'title': title,
  41. 'upload_date': upload_date,
  42. } for format_id, video_url in re.findall(
  43. r'<video class="([^"]+)"[^>]*>\s*<source src="([^"]+)"', webpage)]
  44. return self.playlist_result(entries, lecture_id, title)