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)
51 player_url = self._search_regex(
52 r'playerSwf":"([^"?]*)', webpage, 'player URL')
54 if mobj.group('mediatype').startswith('music/song'):
55 # songs don't store any useful info in the 'context' variable
56 def search_data(name):
57 return self._search_regex(
58 r'data-%s="(.*?)"' % name, webpage, name)
59 streamUrl = search_data('stream-url')
62 'title': self._og_search_title(webpage),
63 'uploader': search_data('artist-name'),
64 'uploader_id': search_data('artist-username'),
65 'playlist': search_data('album-title'),
66 'thumbnail': self._og_search_thumbnail(webpage),
69 context = json.loads(self._search_regex(
70 r'context = ({.*?});', webpage, 'context'))
71 video = context['video']
72 streamUrl = video['streamUrl']
74 'id': compat_str(video['mediaId']),
75 'title': video['title'],
76 'description': video['description'],
77 'thumbnail': video['imageUrl'],
78 'uploader': video['artistName'],
79 'uploader_id': video['artistUsername'],
82 rtmp_url, play_path = streamUrl.split(';', 1)
85 'play_path': play_path,
86 'player_url': player_url,