Commit 4f10d555 authored by Slack's avatar Slack

Fix iTunes scraper

parent 3bae1cf1
......@@ -31,14 +31,14 @@ from ..result import NotFoundResult
READABLE_NAME = 'iTunes Store'
SCRAPER_URL = 'http://itunes.apple.com/'
SCRAPER_URL = 'http://music.apple.com/'
NOTES = 'Multiple track artists or release artists are not split correctly.'
class ReleaseScraper(GetReleaseResultMixin, Scraper, RequestMixin, ExceptionMixin, UtilityMixin, LoggerMixin):
_base_url = 'http://itunes.apple.com/%s/album/'
string_regex = '^http(?:s)?://itunes\.apple\.com/(\w{2,4})/album/([^/]*)/([^\?]+)[^/]*$'
_base_url = 'http://music.apple.com/%s/album/'
string_regex = '^http(?:s)?://music\.apple\.com/(\w{2,4})/album/([^/]*)/([^\?]+)[^/]*$'
exclude_genres = ['music']
......
......@@ -54,7 +54,7 @@ class ITunesTest(TestCase):
expected.append_genre('Goth Rock')
expected.append_genre('College Rock')
expected.set_url('http://itunes.apple.com/us/album/love-remastered/id3022929?ign-mpt=uo%3D4')
expected.set_url('http://music.apple.com/us/album/love-remastered/id3022929?ign-mpt=uo%3D4')
disc = expected.create_disc()
disc.set_number(1)
......@@ -122,7 +122,7 @@ class ITunesTest(TestCase):
expected.append_disc(disc)
s = itunes.ReleaseScraper.from_string('http://itunes.apple.com/us/album/love-remastered/id3022929?ign-mpt=uo%3D4')
s = itunes.ReleaseScraper.from_string('http://music.apple.com/us/album/love-remastered/id3022929?ign-mpt=uo%3D4')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -152,7 +152,7 @@ class ITunesTest(TestCase):
expected.append_genre('Goth Rock')
expected.append_genre('Death Metal/Black Metal')
expected.set_url('https://itunes.apple.com/us/album/dark-passion-play-double-disc/id264697038?uo=4')
expected.set_url('https://music.apple.com/us/album/dark-passion-play-double-disc/id264697038?uo=4')
disc = expected.create_disc()
disc.set_number(1)
......@@ -328,7 +328,7 @@ class ITunesTest(TestCase):
expected.append_disc(disc)
s = itunes.ReleaseScraper.from_string('https://itunes.apple.com/us/album/dark-passion-play-double-disc/id264697038?uo=4')
s = itunes.ReleaseScraper.from_string('https://music.apple.com/us/album/dark-passion-play-double-disc/id264697038?uo=4')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -354,7 +354,7 @@ class ITunesTest(TestCase):
expected.append_genre('Soundtrack')
expected.set_url('https://itunes.apple.com/us/album/twilight-original-motion-picture/id294342468?ign-mpt=uo%3D4')
expected.set_url('https://music.apple.com/us/album/twilight-original-motion-picture/id294342468?ign-mpt=uo%3D4')
disc = expected.create_disc()
disc.set_number(1)
......@@ -527,7 +527,7 @@ class ITunesTest(TestCase):
expected.append_disc(disc)
s = itunes.ReleaseScraper.from_string('https://itunes.apple.com/us/album/twilight-original-motion-picture/id294342468?ign-mpt=uo%3D4')
s = itunes.ReleaseScraper.from_string('https://music.apple.com/us/album/twilight-original-motion-picture/id294342468?ign-mpt=uo%3D4')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -559,7 +559,7 @@ class ITunesTest(TestCase):
expected.append_genre('Rock gothique')
expected.append_genre('College rock')
expected.set_url('http://itunes.apple.com/fr/album/love-remastered/id3022929?ign-mpt=uo%3D4')
expected.set_url('http://music.apple.com/fr/album/love-remastered/id3022929?ign-mpt=uo%3D4')
disc = expected.create_disc()
disc.set_number(1)
......@@ -627,7 +627,7 @@ class ITunesTest(TestCase):
expected.append_disc(disc)
s = itunes.ReleaseScraper.from_string('http://itunes.apple.com/fr/album/love-remastered/id3022929?ign-mpt=uo%3D4')
s = itunes.ReleaseScraper.from_string('http://music.apple.com/fr/album/love-remastered/id3022929?ign-mpt=uo%3D4')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -653,7 +653,7 @@ class ITunesTest(TestCase):
expected.append_genre('Classical')
expected.set_url('https://itunes.apple.com/us/album/chopin-piano-works/id77261376')
expected.set_url('https://music.apple.com/us/album/chopin-piano-works/id77261376')
disc = expected.create_disc()
disc.set_number(1)
......@@ -1283,7 +1283,7 @@ class ITunesTest(TestCase):
expected.append_disc(disc)
s = itunes.ReleaseScraper.from_string('https://itunes.apple.com/us/album/chopin-piano-works/id77261376')
s = itunes.ReleaseScraper.from_string('https://music.apple.com/us/album/chopin-piano-works/id77261376')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -1292,7 +1292,7 @@ class ITunesTest(TestCase):
expected = NotFoundResult()
expected.set_scraper_name(None)
s = itunes.ReleaseScraper.from_string('http://itunes.apple.com/us/album/blubb/id999999999999')
s = itunes.ReleaseScraper.from_string('http://music.apple.com/us/album/blubb/id999999999999')
r = s.get_result()
self.assertEqual(expected, r)
......@@ -1301,7 +1301,7 @@ class ITunesTest(TestCase):
expected = NotFoundResult()
expected.set_scraper_name(None)
s = itunes.ReleaseScraper.from_string('http://itunes.apple.com/fr/album/blubb/id999999999999')
s = itunes.ReleaseScraper.from_string('http://music.apple.com/fr/album/blubb/id999999999999')
r = s.get_result()
self.assertEqual(expected, r)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment