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.

63 lines
2.5 KiB

  1. from __future__ import unicode_literals
  2. import re
  3. from .common import InfoExtractor
  4. class MusicVaultIE(InfoExtractor):
  5. _VALID_URL = r'https?://www\.musicvault\.com/(?P<uploader_id>[^/?#]*)/video/(?P<display_id>[^/?#]*)_(?P<id>[0-9]+)\.html'
  6. _TEST = {
  7. 'url': 'http://www.musicvault.com/the-allman-brothers-band/video/straight-from-the-heart_1010863.html',
  8. 'md5': '3adcbdb3dcc02d647539e53f284ba171',
  9. 'info_dict': {
  10. 'id': '1010863',
  11. 'ext': 'mp4',
  12. 'uploader_id': 'the-allman-brothers-band',
  13. 'title': 'Straight from the Heart',
  14. 'duration': 244,
  15. 'uploader': 'The Allman Brothers Band',
  16. 'thumbnail': 're:^https?://.*/thumbnail/.*',
  17. 'upload_date': '20131219',
  18. 'location': 'Capitol Theatre (Passaic, NJ)',
  19. 'description': 'Listen to The Allman Brothers Band perform Straight from the Heart at Capitol Theatre (Passaic, NJ) on Dec 16, 1981',
  20. 'timestamp': int,
  21. }
  22. }
  23. def _real_extract(self, url):
  24. mobj = re.match(self._VALID_URL, url)
  25. display_id = mobj.group('display_id')
  26. webpage = self._download_webpage(url, display_id)
  27. thumbnail = self._search_regex(
  28. r'<meta itemprop="thumbnail" content="([^"]+)"',
  29. webpage, 'thumbnail', fatal=False)
  30. data_div = self._search_regex(
  31. r'(?s)<div class="data">(.*?)</div>', webpage, 'data fields')
  32. uploader = self._html_search_regex(
  33. r'<h1.*?>(.*?)</h1>', data_div, 'uploader', fatal=False)
  34. title = self._html_search_regex(
  35. r'<h2.*?>(.*?)</h2>', data_div, 'title')
  36. location = self._html_search_regex(
  37. r'<h4.*?>(.*?)</h4>', data_div, 'location', fatal=False)
  38. kaltura_id = self._search_regex(
  39. r'<div id="video-detail-player" data-kaltura-id="([^"]+)"',
  40. webpage, 'kaltura ID')
  41. wid = self._search_regex(r'/wid/_([0-9]+)/', webpage, 'wid')
  42. return {
  43. 'id': mobj.group('id'),
  44. '_type': 'url_transparent',
  45. 'url': 'kaltura:%s:%s' % (wid, kaltura_id),
  46. 'ie_key': 'Kaltura',
  47. 'display_id': display_id,
  48. 'uploader_id': mobj.group('uploader_id'),
  49. 'thumbnail': thumbnail,
  50. 'description': self._html_search_meta('description', webpage),
  51. 'location': location,
  52. 'title': title,
  53. 'uploader': uploader,
  54. }