mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-30 15:14:14 +01:00
Compare commits
3 Commits
18b5b4f569
...
905b6d82b7
Author | SHA1 | Date | |
---|---|---|---|
|
905b6d82b7 | ||
|
b49d5f232a | ||
|
be2e1bcb31 |
@ -1,7 +1,6 @@
|
|||||||
# ex:ts=4:sw=4:sts=4:et
|
# ex:ts=4:sw=4:sts=4:et
|
||||||
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||||
import copy
|
import copy
|
||||||
import json
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from svtplay_dl.error import ServiceError
|
from svtplay_dl.error import ServiceError
|
||||||
@ -17,15 +16,21 @@ class Sr(Service, OpenGraphThumbMixin):
|
|||||||
data = self.get_urldata()
|
data = self.get_urldata()
|
||||||
|
|
||||||
match = re.search(r'data-audio-id="(\d+)"', data)
|
match = re.search(r'data-audio-id="(\d+)"', data)
|
||||||
match2 = re.search(r'data-audio-type="(\w+)"', data)
|
match2 = re.search(r'data-publication-id="(\w+)"', data)
|
||||||
if match and match2:
|
if match and match2:
|
||||||
aid = match.group(1)
|
aid = match.group(1)
|
||||||
type = match2.group(1)
|
pubid = match2.group(1)
|
||||||
else:
|
else:
|
||||||
yield ServiceError("Can't find audio info")
|
yield ServiceError("Can't find audio info")
|
||||||
return
|
return
|
||||||
|
|
||||||
dataurl = f"https://sverigesradio.se/sida/playerajax/getaudiourl?id={aid}&type={type}&quality=high&format=iis"
|
for what in ["episode", "secondary"]:
|
||||||
data = self.http.request("get", dataurl).text
|
language = ""
|
||||||
playerinfo = json.loads(data)
|
apiurl = f"https://sverigesradio.se/playerajax/audio?id={aid}&type={what}&publicationid={pubid}&quality=high"
|
||||||
yield HTTP(copy.copy(self.config), playerinfo["audioUrl"], 128, output=self.output)
|
resp = self.http.request("get", apiurl)
|
||||||
|
if resp.status_code > 400:
|
||||||
|
continue
|
||||||
|
playerinfo = resp.json()
|
||||||
|
if what == "secondary":
|
||||||
|
language = "musik"
|
||||||
|
yield HTTP(copy.copy(self.config), playerinfo["audioUrl"], 128, output=self.output, language=language)
|
||||||
|
@ -53,17 +53,19 @@ class Urplay(Service, OpenGraphThumbMixin):
|
|||||||
logging.error("Can't find video info.")
|
logging.error("Can't find video info.")
|
||||||
return episodes
|
return episodes
|
||||||
|
|
||||||
data = unescape(match.group(1))
|
jsondata = json.loads(match.group(1))
|
||||||
jsondata = json.loads(data)
|
|
||||||
seasons = jsondata["props"]["pageProps"]["superSeriesSeasons"]
|
seasons = jsondata["props"]["pageProps"]["superSeriesSeasons"]
|
||||||
|
build = jsondata["buildId"]
|
||||||
|
|
||||||
parse = urlparse(self.url)
|
parse = urlparse(self.url)
|
||||||
url = f"https://{parse.netloc}{parse.path}"
|
url = f"https://{parse.netloc}{parse.path}"
|
||||||
episodes.append(url)
|
episodes.append(url)
|
||||||
if seasons:
|
if seasons:
|
||||||
for season in seasons:
|
for season in seasons:
|
||||||
res = self.http.get(f'https://urplay.se/api/v1/series?id={season["id"]}')
|
res = self.http.get(
|
||||||
for episode in res.json()["programs"]:
|
f'https://urplay.se/_next/data/{build}{season["link"]}.json?productType={jsondata["query"]["productType"]}&id={jsondata["props"]["pageProps"]["program"]["seriesId"]}',
|
||||||
|
)
|
||||||
|
for episode in res.json()["pageProps"]["program"]["series"]["programs"]:
|
||||||
url = urljoin("https://urplay.se", episode["link"])
|
url = urljoin("https://urplay.se", episode["link"])
|
||||||
if url not in episodes:
|
if url not in episodes:
|
||||||
episodes.append(url)
|
episodes.append(url)
|
||||||
|
6
setup.py
6
setup.py
@ -46,7 +46,11 @@ setup(
|
|||||||
packages=find_packages("lib", exclude=["tests", "*.tests", "*.tests.*"]),
|
packages=find_packages("lib", exclude=["tests", "*.tests", "*.tests.*"]),
|
||||||
install_requires=deps,
|
install_requires=deps,
|
||||||
package_dir={"": "lib"},
|
package_dir={"": "lib"},
|
||||||
scripts=["bin/svtplay-dl"],
|
entry_points={
|
||||||
|
"console_scripts": [
|
||||||
|
"svtplat-dl = svtplay_dl:main",
|
||||||
|
],
|
||||||
|
},
|
||||||
author="Johan Andersson",
|
author="Johan Andersson",
|
||||||
author_email="j@i19.se",
|
author_email="j@i19.se",
|
||||||
description="Command-line program to download videos from various video on demand sites",
|
description="Command-line program to download videos from various video on demand sites",
|
||||||
|
Loading…
Reference in New Issue
Block a user