From 7db9f7ef7fea7c4910e44eee999f7c8df6013bcc Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Sun, 27 Sep 2020 20:36:51 +0200 Subject: [PATCH] solidtango: add support for user / passwd for solidsport --- lib/svtplay_dl/service/solidtango.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/svtplay_dl/service/solidtango.py b/lib/svtplay_dl/service/solidtango.py index 7703b5b..db87e67 100644 --- a/lib/svtplay_dl/service/solidtango.py +++ b/lib/svtplay_dl/service/solidtango.py @@ -15,6 +15,26 @@ class Solidtango(Service): def get(self): data = self.get_urldata() + parse = urlparse(self.url) + if "solidsport" in parse.netloc: + if self.config.get("username") and self.config.get("password"): + res = self.http.request("get", "https://solidsport.com/login") + match = re.search('authenticity_token" value="([^"]+)"', res.text) + if not match: + yield ServiceError("Cant find auth token for login") + return + pdata = { + "authenticity_token": match.group(1), + "user[email]": self.config.get("username"), + "user[password]": self.config.get("password"), + "commit": "Sign in", + "utf8": "✓", + } + res = self.http.request("post", "https://solidsport.com/login", data=pdata) + if "Wrong passwor" in res.text or "Can't find account" in res.text: + yield ServiceError("Wrong username or password") + return + data = self.http.request("get", self.url).text match = re.search('src="(http://mm-resource-service.herokuapp.com[^"]*)"', data) if match: