1 from __future__ import unicode_literals
6 from .common import InfoExtractor
12 class MySpaceIE(InfoExtractor):
13 _VALID_URL = r'https?://myspace\.com/([^/]+)/(?P<mediatype>video/[^/]+/|music/song/.*?)(?P<id>\d+)'
17 'url': 'https://myspace.com/coldplay/video/viva-la-vida/100008689',
21 'title': 'Viva La Vida',
22 'description': 'The official Viva La Vida video, directed by Hype Williams',
23 'uploader': 'Coldplay',
24 'uploader_id': 'coldplay',
28 'skip_download': True,
33 'url': 'https://myspace.com/spiderbags/music/song/darkness-in-my-heart-39008454-27041242',
37 'title': 'Darkness In My Heart',
38 'uploader_id': 'spiderbags',
42 'skip_download': True,
47 def _real_extract(self, url):
48 mobj = re.match(self._VALID_URL, url)
49 video_id = mobj.group('id')
50 webpage = self._download_webpage(url, video_id)
52 if mobj.group('mediatype').startswith('music/song'):
53 # songs don't store any useful info in the 'context' variable
54 def search_data(name):
55 return self._search_regex(
56 r'data-%s="(.*?)"' % name, webpage, name)
57 streamUrl = search_data('stream-url')
60 'title': self._og_search_title(webpage),
61 'uploader_id': search_data('artist-username'),
62 'thumbnail': self._og_search_thumbnail(webpage),
65 context = json.loads(self._search_regex(
66 r'context = ({.*?});', webpage, 'context'))
67 video = context['video']
68 streamUrl = video['streamUrl']
70 'id': compat_str(video['mediaId']),
71 'title': video['title'],
72 'description': video['description'],
73 'thumbnail': video['imageUrl'],
74 'uploader': video['artistName'],
75 'uploader_id': video['artistUsername'],
78 rtmp_url, play_path = streamUrl.split(';', 1)
81 'play_path': play_path,