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.

56 lines
1.8 KiB

10 years ago
  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. from ..utils import int_or_none
  5. class SciVeeIE(InfoExtractor):
  6. _VALID_URL = r'https?://(?:www\.)?scivee\.tv/node/(?P<id>\d+)'
  7. _TEST = {
  8. 'url': 'http://www.scivee.tv/node/62352',
  9. 'md5': 'b16699b74c9e6a120f6772a44960304f',
  10. 'info_dict': {
  11. 'id': '62352',
  12. 'ext': 'mp4',
  13. 'title': 'Adam Arkin at the 2014 DOE JGI Genomics of Energy & Environment Meeting',
  14. 'description': 'md5:81f1710638e11a481358fab1b11059d7',
  15. },
  16. }
  17. def _real_extract(self, url):
  18. mobj = re.match(self._VALID_URL, url)
  19. video_id = mobj.group('id')
  20. # annotations XML is malformed
  21. annotations = self._download_webpage(
  22. 'http://www.scivee.tv/assets/annotations/%s' % video_id, video_id, 'Downloading annotations')
  23. title = self._html_search_regex(r'<title>([^<]+)</title>', annotations, 'title')
  24. description = self._html_search_regex(r'<abstract>([^<]+)</abstract>', annotations, 'abstract', fatal=False)
  25. filesize = int_or_none(self._html_search_regex(
  26. r'<filesize>([^<]+)</filesize>', annotations, 'filesize', fatal=False))
  27. formats = [
  28. {
  29. 'url': 'http://www.scivee.tv/assets/audio/%s' % video_id,
  30. 'ext': 'mp3',
  31. 'format_id': 'audio',
  32. },
  33. {
  34. 'url': 'http://www.scivee.tv/assets/video/%s' % video_id,
  35. 'ext': 'mp4',
  36. 'format_id': 'video',
  37. 'filesize': filesize,
  38. },
  39. ]
  40. return {
  41. 'id': video_id,
  42. 'title': title,
  43. 'description': description,
  44. 'thumbnail': 'http://www.scivee.tv/assets/videothumb/%s' % video_id,
  45. 'formats': formats,
  46. }