From 2bddaba8267501a3655a08a8c6254708ab6fe8fa Mon Sep 17 00:00:00 2001 From: Johan Andersson Date: Wed, 29 Jul 2020 23:14:54 +0200 Subject: [PATCH] cmore: fix user and password --- lib/svtplay_dl/service/cmore.py | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/svtplay_dl/service/cmore.py b/lib/svtplay_dl/service/cmore.py index 3b4ce98..ea5b002 100644 --- a/lib/svtplay_dl/service/cmore.py +++ b/lib/svtplay_dl/service/cmore.py @@ -82,26 +82,32 @@ class Cmore(Service): def _login(self): tld = self._gettld() - url = "https://www.cmore.{}/login".format(tld) - res = self.http.get(url, cookies=self.cookies) if self.config.get("cmoreoperator"): + url = "https://tve.cmore.se/country/{}/operator/{}/user/{}/exists?client=cmore-web-prod".format( + tld, self.config.get("cmoreoperator"), self.config.get("username") + ) post = { - "username": self.config.get("username"), "password": self.config.get("password"), - "operator": self.config.get("cmoreoperator"), - "country_code": tld, } else: - post = {"username": self.config.get("username"), "password": self.config.get("password")} - res = self.http.post("https://account.cmore.{}/session?client=cmore-web-prod".format(tld), json=post, cookies=self.cookies) + url = "https://account-delta.b17g.services/api?client=cmore-web" + post = { + "query": "mutation($username: String, $password: String, $site: String) { login(credentials:" + "{username: $username, password: $password}, site: $site) { user { ...UserFields } session { token vimondToken } }} " + "fragment UserFields on User { acceptedCmoreTerms acceptedPlayTerms countryCode email firstName genericAds " + "lastName tv4UserDataComplete userId username yearOfBirth zipCode type}", + "variables": {"username": self.config.get("username"), "password": self.config.get("password"), "site": "CMORE_SE"}, + } + + res = self.http.post(url, json=post, cookies=self.cookies) if res.status_code >= 400: return None, "Wrong username or password" janson = res.json() - token = janson["data"]["vimond_token"] + token = janson["data"]["login"]["session"]["vimondToken"] return token, None def operatorlist(self): - res = self.http.get("https://tve.cmore.se/country/{}/operator?client=cmore-web".format(self._gettld())) + res = self.http.get("https://tve.cmore.se/country/{}/operator?client=cmore-web-prod".format(self._gettld())) for i in res.json()["data"]["operators"]: print("operator: '{}'".format(i["name"].lower()))