logo

youtube-dl

[mirror] Download/Watch videos from video hostersgit clone https://hacktivis.me/git/mirror/youtube-dl.git

teletask.py (1739B)


  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. 'id': '26168',
  11. 'title': 'Duplicate Detection',
  12. },
  13. 'playlist': [{
  14. 'md5': '290ef69fb2792e481169c3958dbfbd57',
  15. 'info_dict': {
  16. 'id': '26168-speaker',
  17. 'ext': 'mp4',
  18. 'title': 'Duplicate Detection',
  19. 'upload_date': '20141218',
  20. }
  21. }, {
  22. 'md5': 'e1e7218c5f0e4790015a437fcf6c71b4',
  23. 'info_dict': {
  24. 'id': '26168-slides',
  25. 'ext': 'mp4',
  26. 'title': 'Duplicate Detection',
  27. 'upload_date': '20141218',
  28. }
  29. }]
  30. }
  31. def _real_extract(self, url):
  32. lecture_id = self._match_id(url)
  33. webpage = self._download_webpage(url, lecture_id)
  34. title = self._html_search_regex(
  35. r'itemprop="name">([^<]+)</a>', webpage, 'title')
  36. upload_date = unified_strdate(self._html_search_regex(
  37. r'Date:</td><td>([^<]+)</td>', webpage, 'date', fatal=False))
  38. entries = [{
  39. 'id': '%s-%s' % (lecture_id, format_id),
  40. 'url': video_url,
  41. 'title': title,
  42. 'upload_date': upload_date,
  43. } for format_id, video_url in re.findall(
  44. r'<video class="([^"]+)"[^>]*>\s*<source src="([^"]+)"', webpage)]
  45. return self.playlist_result(entries, lecture_id, title)