From 47ed1af55fa6e9dbfe2ad26dcbe3f0c94e426659 Mon Sep 17 00:00:00 2001 From: Tithen-Firion Date: Sat, 29 Nov 2014 23:54:51 +0100 Subject: [PATCH] Update myspace.py --- youtube_dl/extractor/myspace.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/youtube_dl/extractor/myspace.py b/youtube_dl/extractor/myspace.py index c3c1a27c3..57f48153b 100644 --- a/youtube_dl/extractor/myspace.py +++ b/youtube_dl/extractor/myspace.py @@ -48,6 +48,8 @@ class MySpaceIE(InfoExtractor): mobj = re.match(self._VALID_URL, url) video_id = mobj.group('id') webpage = self._download_webpage(url, video_id) + player_url = self._search_regex( + r'playerSwf":"([^"?]*)', webpage, 'player URL') if mobj.group('mediatype').startswith('music/song'): # songs don't store any useful info in the 'context' variable @@ -79,6 +81,33 @@ class MySpaceIE(InfoExtractor): info.update({ 'url': rtmp_url, 'play_path': play_path, + 'player_url': player_url, 'ext': 'flv', }) return info + + +class MySpaceAlbumIE(InfoExtractor): + IE_NAME = 'MySpace:album' + _VALID_URL = r'https?://myspace\.com/([^/]+)/music/album/(?P.*?)(?P<id>\d+)' + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + playlist_id = mobj.group('id') + display_id = mobj.group('title') + playlist_id + webpage = self._download_webpage(url, display_id) + tracks_paths = re.findall(r'"music:song" content="(.*?)"', webpage) + if not tracks_paths: + raise ExtractorError('The page doesn\'t contain any tracks') + entries = [ + self.url_result(t_path, ie=MySpaceIE.ie_key()) + for t_path in tracks_paths] + title = self._search_regex( + r'"og:title" content="(.*?)"', webpage, 'title') + return { + '_type': 'playlist', + 'id': playlist_id, + 'display_id': display_id, + 'title': title, + 'entries': entries, + }