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.

48 lines
1.4 KiB

  1. import re
  2. import json
  3. from .common import InfoExtractor
  4. from ..utils import (
  5. compat_str,
  6. )
  7. class MySpaceIE(InfoExtractor):
  8. _VALID_URL = r'https?://myspace\.com/([^/]+)/video/[^/]+/(?P<id>\d+)'
  9. _TEST = {
  10. u'url': u'https://myspace.com/coldplay/video/viva-la-vida/100008689',
  11. u'info_dict': {
  12. u'id': u'100008689',
  13. u'ext': u'flv',
  14. u'title': u'Viva La Vida',
  15. u'description': u'The official Viva La Vida video, directed by Hype Williams',
  16. u'uploader': u'Coldplay',
  17. u'uploader_id': u'coldplay',
  18. },
  19. u'params': {
  20. # rtmp download
  21. u'skip_download': True,
  22. },
  23. }
  24. def _real_extract(self, url):
  25. mobj = re.match(self._VALID_URL, url)
  26. video_id = mobj.group('id')
  27. webpage = self._download_webpage(url, video_id)
  28. context = json.loads(self._search_regex(r'context = ({.*?});', webpage,
  29. u'context'))
  30. video = context['video']
  31. rtmp_url, play_path = video['streamUrl'].split(';', 1)
  32. return {
  33. 'id': compat_str(video['mediaId']),
  34. 'title': video['title'],
  35. 'url': rtmp_url,
  36. 'play_path': play_path,
  37. 'ext': 'flv',
  38. 'description': video['description'],
  39. 'thumbnail': video['imageUrl'],
  40. 'uploader': video['artistName'],
  41. 'uploader_id': video['artistUsername'],
  42. }