mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-24 04:05:39 +01:00
dplay: add discoveryplus support
This commit is contained in:
parent
4fce58c892
commit
d193679855
@ -13,14 +13,15 @@ from svtplay_dl.subtitle import subtitle
|
||||
|
||||
|
||||
country = {"sv": ".se", "da": ".dk", "no": ".no"}
|
||||
REALMS = {"discoveryplus.se": "dplayse", "discoveryplus.no": "dplayno", "discoveryplus.dk": "dplaydk"}
|
||||
|
||||
|
||||
class Dplay(Service):
|
||||
supported_domains = ["dplay.se", "dplay.dk", "dplay.no"]
|
||||
supported_domains = ["discoveryplus.se", "discoveryplus.no", "discoveryplus.dk"]
|
||||
|
||||
def get(self):
|
||||
parse = urlparse(self.url)
|
||||
self.domain = re.search(r"(dplay\.\w\w)", parse.netloc).group(1)
|
||||
self.domain = re.search(r"(discoveryplus\.\w\w)", parse.netloc).group(1)
|
||||
|
||||
if not self._token():
|
||||
logging.error("Something went wrong getting token for requests")
|
||||
@ -116,7 +117,7 @@ class Dplay(Service):
|
||||
|
||||
def find_all_episodes(self, config):
|
||||
parse = urlparse(self.url)
|
||||
self.domain = re.search(r"(dplay\.\w\w)", parse.netloc).group(1)
|
||||
self.domain = re.search(r"(discoveryplus\.\w\w)", parse.netloc).group(1)
|
||||
programid = None
|
||||
seasons = []
|
||||
match = re.search("^/(program|programmer|videos|videoer)/([^/]+)", parse.path)
|
||||
@ -182,7 +183,7 @@ class Dplay(Service):
|
||||
def _token(self) -> bool:
|
||||
# random device id for cookietoken
|
||||
deviceid = hashlib.sha256(bytes(int(random.random() * 1000))).hexdigest()
|
||||
url = "https://disco-api.{}/token?realm={}&deviceId={}&shortlived=true".format(self.domain, self.domain.replace(".", ""), deviceid)
|
||||
url = "https://disco-api.{}/token?realm={}&deviceId={}&shortlived=true".format(self.domain, REALMS[self.domain], deviceid)
|
||||
res = self.http.get(url)
|
||||
if res.status_code >= 400:
|
||||
return False
|
||||
|
Loading…
Reference in New Issue
Block a user