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.

57 lines
1.9 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. 'skip': 'Not accessible from Travis CI server',
  17. }
  18. def _real_extract(self, url):
  19. mobj = re.match(self._VALID_URL, url)
  20. video_id = mobj.group('id')
  21. # annotations XML is malformed
  22. annotations = self._download_webpage(
  23. 'http://www.scivee.tv/assets/annotations/%s' % video_id, video_id, 'Downloading annotations')
  24. title = self._html_search_regex(r'<title>([^<]+)</title>', annotations, 'title')
  25. description = self._html_search_regex(r'<abstract>([^<]+)</abstract>', annotations, 'abstract', fatal=False)
  26. filesize = int_or_none(self._html_search_regex(
  27. r'<filesize>([^<]+)</filesize>', annotations, 'filesize', fatal=False))
  28. formats = [
  29. {
  30. 'url': 'http://www.scivee.tv/assets/audio/%s' % video_id,
  31. 'ext': 'mp3',
  32. 'format_id': 'audio',
  33. },
  34. {
  35. 'url': 'http://www.scivee.tv/assets/video/%s' % video_id,
  36. 'ext': 'mp4',
  37. 'format_id': 'video',
  38. 'filesize': filesize,
  39. },
  40. ]
  41. return {
  42. 'id': video_id,
  43. 'title': title,
  44. 'description': description,
  45. 'thumbnail': 'http://www.scivee.tv/assets/videothumb/%s' % video_id,
  46. 'formats': formats,
  47. }