From 48da538f7d81f7fbac9118fd03f0f329759b3aac Mon Sep 17 00:00:00 2001 From: Allan Daemon Date: Sun, 24 Apr 2016 07:39:02 -0300 Subject: [PATCH 1/3] [myspace] Added support for downloading all songs of an artist --- youtube_dl/extractor/extractors.py | 2 +- youtube_dl/extractor/myspace.py | 43 ++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 03aff1d52..552f565f8 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -666,7 +666,7 @@ from .mtv import ( from .muenchentv import MuenchenTVIE from .mwave import MwaveIE, MwaveMeetGreetIE from .mychannels import MyChannelsIE -from .myspace import MySpaceIE, MySpaceAlbumIE +from .myspace import MySpaceIE, MySpaceAlbumIE, MySpaceArtistSongsIE from .myspass import MySpassIE from .myvi import ( MyviIE, diff --git a/youtube_dl/extractor/myspace.py b/youtube_dl/extractor/myspace.py index e164d5940..876b7299b 100644 --- a/youtube_dl/extractor/myspace.py +++ b/youtube_dl/extractor/myspace.py @@ -210,3 +210,46 @@ class MySpaceAlbumIE(InfoExtractor): 'title': self._og_search_title(webpage), 'entries': entries, } + + +class MySpaceArtistSongsIE(InfoExtractor): + IE_NAME = 'MySpace:artist:songs' + _VALID_URL = r'https?://myspace\.com/(?P[^/]*)/music/songs' + + _TESTS = [{ + 'url': 'https://myspace.com/starset2/music/album/transmissions-19455773', + 'url': 'https://myspace.com/ryanlewismusic/music/songs', + 'info_dict': { + 'title': 'RYAN LEWIS', + }, + 'playlist_count': 8, + }, { + 'url': 'https://myspace.com/studio99/music/songs/', + 'info_dict': { + 'title': 'Studio 99 IS CLOSED!! R.I.P.', + }, + 'playlist_count': 4, + }] + + def _real_extract(self, url): + mobj = re.match(self._VALID_URL, url) + display_id = mobj.group('artist') + webpage = self._download_webpage(url, display_id) + tracks_paths = re.findall(r'', webpage) + if not tracks_paths: + raise ExtractorError( + '%s: No songs found, try using proxy' % display_id, + expected=True) + + entries = [ + self.url_result('https://myspace.com/' + display_id + t_path, ie=MySpaceIE.ie_key()) + for t_path in tracks_paths if t_path.startswith('/music/song/')] + # if we invert this if, we get album urls. but not all music are in alba. + # Also the musics in alba are already here individually + + return { + '_type': 'playlist', + 'display_id': display_id, + 'title': self._og_search_title(webpage), + 'entries': entries, + } From 7ae403d9fd0b7bc01656aa7b9b53d798ad503c49 Mon Sep 17 00:00:00 2001 From: Allan Daemon Date: Tue, 26 Apr 2016 03:14:37 -0300 Subject: [PATCH 2/3] [myspace] Fix issues for merging of all songs of an artist inclusion --- youtube_dl/extractor/myspace.py | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/youtube_dl/extractor/myspace.py b/youtube_dl/extractor/myspace.py index 876b7299b..fc1dbfbde 100644 --- a/youtube_dl/extractor/myspace.py +++ b/youtube_dl/extractor/myspace.py @@ -203,33 +203,20 @@ class MySpaceAlbumIE(InfoExtractor): entries = [ self.url_result(t_path, ie=MySpaceIE.ie_key()) for t_path in tracks_paths] - return { - '_type': 'playlist', - 'id': playlist_id, - 'display_id': display_id, - 'title': self._og_search_title(webpage), - 'entries': entries, - } + return self.playlist_result(entries, playlist_id, self._og_search_title(webpage)) class MySpaceArtistSongsIE(InfoExtractor): IE_NAME = 'MySpace:artist:songs' _VALID_URL = r'https?://myspace\.com/(?P[^/]*)/music/songs' - _TESTS = [{ - 'url': 'https://myspace.com/starset2/music/album/transmissions-19455773', - 'url': 'https://myspace.com/ryanlewismusic/music/songs', - 'info_dict': { - 'title': 'RYAN LEWIS', - }, - 'playlist_count': 8, - }, { + _TEST = { 'url': 'https://myspace.com/studio99/music/songs/', 'info_dict': { 'title': 'Studio 99 IS CLOSED!! R.I.P.', }, 'playlist_count': 4, - }] + } def _real_extract(self, url): mobj = re.match(self._VALID_URL, url) @@ -247,9 +234,4 @@ class MySpaceArtistSongsIE(InfoExtractor): # if we invert this if, we get album urls. but not all music are in alba. # Also the musics in alba are already here individually - return { - '_type': 'playlist', - 'display_id': display_id, - 'title': self._og_search_title(webpage), - 'entries': entries, - } + return self.playlist_result(entries, playlist_title=self._og_search_title(webpage)) From f8703c429117a92ad63d2c94a99eee6d6f1165ae Mon Sep 17 00:00:00 2001 From: Allan Daemon Date: Sun, 14 May 2017 13:53:57 -0300 Subject: [PATCH 3/3] Give MySpace artist support a better name --- youtube_dl/extractor/extractors.py | 2 +- youtube_dl/extractor/myspace.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/youtube_dl/extractor/extractors.py b/youtube_dl/extractor/extractors.py index 552f565f8..574f53e5c 100644 --- a/youtube_dl/extractor/extractors.py +++ b/youtube_dl/extractor/extractors.py @@ -666,7 +666,7 @@ from .mtv import ( from .muenchentv import MuenchenTVIE from .mwave import MwaveIE, MwaveMeetGreetIE from .mychannels import MyChannelsIE -from .myspace import MySpaceIE, MySpaceAlbumIE, MySpaceArtistSongsIE +from .myspace import MySpaceIE, MySpaceAlbumIE, MySpaceArtistIE from .myspass import MySpassIE from .myvi import ( MyviIE, diff --git a/youtube_dl/extractor/myspace.py b/youtube_dl/extractor/myspace.py index fc1dbfbde..fbf015a11 100644 --- a/youtube_dl/extractor/myspace.py +++ b/youtube_dl/extractor/myspace.py @@ -206,8 +206,8 @@ class MySpaceAlbumIE(InfoExtractor): return self.playlist_result(entries, playlist_id, self._og_search_title(webpage)) -class MySpaceArtistSongsIE(InfoExtractor): - IE_NAME = 'MySpace:artist:songs' +class MySpaceArtistIE(InfoExtractor): + IE_NAME = 'MySpace:artist' _VALID_URL = r'https?://myspace\.com/(?P[^/]*)/music/songs' _TEST = {