Skip to content

Commit

Permalink
Fix wrong results for Spotify email queries
Browse files Browse the repository at this point in the history
- Bump version to 1.2.1
  • Loading branch information
iojw committed Jul 7, 2020
1 parent a46260b commit aec8b71
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
2 changes: 1 addition & 1 deletion socialscan/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "1.2.0"
__version__ = "1.2.1"
18 changes: 7 additions & 11 deletions socialscan/platforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,21 +582,17 @@ async def check_username(self, username):

class Spotify(PlatformChecker):
URL = "https://www.spotify.com/signup/"
EMAIL_ENDPOINT = "https://www.spotify.com/sg-en/xhr/json/isEmailAvailable.php"
EMAIL_ENDPOINT = "https://spclient.wg.spotify.com/signup/public/v1/account"

async def check_email(self, email):
async with self.get(
Spotify.EMAIL_ENDPOINT, params={"signup_form[email]": email, "email": email}
) as r:
text = await r.text()
if text == "true":
async with self.get(Spotify.EMAIL_ENDPOINT, params={"validate": 1, "email": email}) as r:
json_body = await self.get_json(r)
if json_body["status"] == 1:
return self.response_available(email)
elif text == "false":
return self.response_unavailable(email)
elif json_body["status"] == 20:
return self.response_unavailable(email, message=json_body["errors"]["email"])
else:
return self.response_failure(
email, message=PlatformChecker.TOO_MANY_REQUEST_ERROR_MESSAGE
)
return self.response_failure(email, message=json_body["errors"]["email"])


class Yahoo(PlatformChecker):
Expand Down

0 comments on commit aec8b71

Please sign in to comment.