mirror of
https://github.com/spaam/svtplay-dl.git
synced 2024-11-26 21:25:39 +01:00
Compare commits
8 Commits
83e85e53fa
...
9d1baaa88d
Author | SHA1 | Date | |
---|---|---|---|
|
9d1baaa88d | ||
|
85d93464e2 | ||
|
515ab99c7a | ||
|
757be3c748 | ||
|
905b6d82b7 | ||
|
b49d5f232a | ||
|
be2e1bcb31 | ||
|
cafdfba356 |
70
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
70
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@ -0,0 +1,70 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
<!--- Please fill out this template to the best of your ability. You can always edit this issue once you have created it. -->
|
||||
<!--- Before you start make sure that you are running the latest svtplay-dl and FFmpeg version. Also check that you can watch the tv show online in a web browser. -->
|
||||
<!--- Always include the URL you want to download and all switches you are using. --->
|
||||
|
||||
## Bug report
|
||||
### Describe the bug
|
||||
Here is a clear and concise description of what the problem is:
|
||||
<!--- Provide a more detailed introduction to the issue itself, and why you consider it to be a bug -->
|
||||
<!--- A bug report that is not clear will be closed -->
|
||||
<!--- Put your text below this line -->
|
||||
|
||||
## Expected Behavior
|
||||
Here is a clear and concise description of what was expected to happen:
|
||||
<!--- Tell us what should happen -->
|
||||
<!--- Put your text below this line -->
|
||||
|
||||
## Actual Behavior
|
||||
<!--- Tell us what happens instead -->
|
||||
<!--- Put your text below this line -->
|
||||
|
||||
## Possible Fix
|
||||
<!--- Not obligatory, but suggest a fix or reason for the bug -->
|
||||
<!--- Put your text below this line -->
|
||||
|
||||
### To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
<!--- Provide a link to a live example, or an unambiguous set of steps to -->
|
||||
<!--- reproduce this bug. Include code to reproduce, if relevant -->
|
||||
<!--- Put your text below this line -->
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
|
||||
### Screenshots
|
||||
Here are some links or screenshots to help explain the problem:
|
||||
<!--- Put your text/pictures below this line -->
|
||||
|
||||
## Additional context or screenshots (if appropriate)
|
||||
Here is some additional context or explanation that might help:
|
||||
<!--- How has this bug affected you? What were you trying to accomplish? -->
|
||||
<!--- Put your text below this line -->
|
||||
|
||||
### Your Environment
|
||||
Used Operating system:
|
||||
<!--- Include as many relevant details about the environment you experienced the bug in -->
|
||||
<!--- Checkboxes can easily be ticked once issue is created -->
|
||||
- [ ] Linux
|
||||
- [ ] OSX
|
||||
- [ ] Windows
|
||||
- [ ] Other (tell us what):
|
||||
|
||||
Used versions:
|
||||
- svtplay-dl version:
|
||||
- FFmpeg version:
|
||||
- Python version (not needed for Windows):
|
||||
|
||||
### Verbose log
|
||||
<!--- A verbose log is always mandatory when creating an issue. -->
|
||||
<!--- Add --verbose like this: svtplay-dl --verbose https://www.example.com -->
|
||||
<!--- Put your verbose log below this line -->
|
||||
:
|
||||
|
@ -31,7 +31,7 @@ class postprocess:
|
||||
if os.path.isfile(path):
|
||||
self.detect = path
|
||||
|
||||
def merge(self):
|
||||
def merge(self, merge_subtitle):
|
||||
if self.detect is None:
|
||||
logging.error("Cant detect ffmpeg or avconv. Cant mux files without it.")
|
||||
return
|
||||
@ -60,7 +60,7 @@ class postprocess:
|
||||
streams = _streams(stderr)
|
||||
videotrack, audiotrack = _checktracks(streams)
|
||||
|
||||
if self.config.get("merge_subtitle"):
|
||||
if merge_subtitle:
|
||||
logging.info("Merge audio, video and subtitle into %s", new_name.name)
|
||||
else:
|
||||
logging.info(f"Merge audio and video into {str(new_name.name).replace('.audio', '')}")
|
||||
@ -89,7 +89,7 @@ class postprocess:
|
||||
arguments += ["-map", f"{videotrack}"]
|
||||
if audiotrack:
|
||||
arguments += ["-map", f"{audiotrack}"]
|
||||
if self.config.get("merge_subtitle"):
|
||||
if merge_subtitle:
|
||||
langs = _sublanguage(self.stream, self.config, self.subfixes)
|
||||
tracks = [x for x in [videotrack, audiotrack] if x]
|
||||
subs_nr = 0
|
||||
@ -135,7 +135,7 @@ class postprocess:
|
||||
os.remove(audio_filename)
|
||||
|
||||
# This if statement is for use cases where both -S and -M are specified to not only merge the subtitle but also store it separately.
|
||||
if self.config.get("merge_subtitle") and not self.config.get("subtitle"):
|
||||
if merge_subtitle and not self.config.get("subtitle"):
|
||||
if self.subfixes and len(self.subfixes) >= 2 and self.config.get("get_all_subtitles"):
|
||||
for subfix in self.subfixes:
|
||||
subfile = orig_filename.parent / (orig_filename.stem + "." + subfix + ".srt")
|
||||
|
@ -1,7 +1,6 @@
|
||||
# ex:ts=4:sw=4:sts=4:et
|
||||
# -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
||||
import copy
|
||||
import json
|
||||
import re
|
||||
|
||||
from svtplay_dl.error import ServiceError
|
||||
@ -17,15 +16,21 @@ class Sr(Service, OpenGraphThumbMixin):
|
||||
data = self.get_urldata()
|
||||
|
||||
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:
|
||||
aid = match.group(1)
|
||||
type = match2.group(1)
|
||||
pubid = match2.group(1)
|
||||
else:
|
||||
yield ServiceError("Can't find audio info")
|
||||
return
|
||||
|
||||
dataurl = f"https://sverigesradio.se/sida/playerajax/getaudiourl?id={aid}&type={type}&quality=high&format=iis"
|
||||
data = self.http.request("get", dataurl).text
|
||||
playerinfo = json.loads(data)
|
||||
yield HTTP(copy.copy(self.config), playerinfo["audioUrl"], 128, output=self.output)
|
||||
for what in ["episode", "secondary"]:
|
||||
language = ""
|
||||
apiurl = f"https://sverigesradio.se/playerajax/audio?id={aid}&type={what}&publicationid={pubid}&quality=high"
|
||||
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)
|
||||
|
@ -198,7 +198,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
res = self.http.request(
|
||||
"post",
|
||||
"https://client-gateway.tv4.a2d.tv/graphql",
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
|
||||
json=data,
|
||||
)
|
||||
janson = res.json()
|
||||
@ -242,7 +242,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
res = self.http.request(
|
||||
"post",
|
||||
"https://client-gateway.tv4.a2d.tv/graphql",
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json", "Authorization": f"Bearer {token}"},
|
||||
json=data,
|
||||
)
|
||||
return res.json()
|
||||
@ -261,7 +261,7 @@ class Tv4play(Service, OpenGraphThumbMixin):
|
||||
res = self.http.request(
|
||||
"post",
|
||||
"https://client-gateway.tv4.a2d.tv/graphql",
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "4.0.0", "Content-Type": "application/json"},
|
||||
headers={"Client-Name": "tv4-web", "Client-Version": "5.2.0", "Content-Type": "application/json"},
|
||||
json=data,
|
||||
)
|
||||
janson = res.json()
|
||||
|
@ -53,17 +53,19 @@ class Urplay(Service, OpenGraphThumbMixin):
|
||||
logging.error("Can't find video info.")
|
||||
return episodes
|
||||
|
||||
data = unescape(match.group(1))
|
||||
jsondata = json.loads(data)
|
||||
jsondata = json.loads(match.group(1))
|
||||
seasons = jsondata["props"]["pageProps"]["superSeriesSeasons"]
|
||||
build = jsondata["buildId"]
|
||||
|
||||
parse = urlparse(self.url)
|
||||
url = f"https://{parse.netloc}{parse.path}"
|
||||
episodes.append(url)
|
||||
if seasons:
|
||||
for season in seasons:
|
||||
res = self.http.get(f'https://urplay.se/api/v1/series?id={season["id"]}')
|
||||
for episode in res.json()["programs"]:
|
||||
res = self.http.get(
|
||||
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"])
|
||||
if url not in episodes:
|
||||
episodes.append(url)
|
||||
|
@ -153,8 +153,9 @@ def get_one_media(stream):
|
||||
logging.info("No subtitles available")
|
||||
return
|
||||
|
||||
merge_subtitle = False
|
||||
if not stream.config.get("list_quality"):
|
||||
subtitle_decider(stream, subtitles)
|
||||
merge_subtitle = subtitle_decider(stream, subtitles)
|
||||
if stream.config.get("force_subtitle"):
|
||||
return
|
||||
|
||||
@ -219,6 +220,6 @@ def get_one_media(stream):
|
||||
if fstream.audio and not post.detect and fstream.finished:
|
||||
logging.warning("Can't find ffmpeg/avconv. audio and video is in seperate files. if you dont want this use -P hls or hds")
|
||||
if post.detect and fstream.config.get("no_merge") is False:
|
||||
post.merge()
|
||||
post.merge(merge_subtitle)
|
||||
else:
|
||||
logging.info("All done. Not postprocessing files, leaving them completely untouched.")
|
||||
|
@ -119,8 +119,8 @@ def subtitle_decider(stream, subtitles):
|
||||
print(subtitles[0].url)
|
||||
else:
|
||||
subtitles[0].download()
|
||||
elif stream.config.get("merge_subtitle"):
|
||||
stream.config.set("merge_subtitle", False)
|
||||
return stream.config.get("merge_subtitle")
|
||||
return False
|
||||
|
||||
|
||||
def resolution(streams, resolutions: List) -> List:
|
||||
|
6
setup.py
6
setup.py
@ -46,7 +46,11 @@ setup(
|
||||
packages=find_packages("lib", exclude=["tests", "*.tests", "*.tests.*"]),
|
||||
install_requires=deps,
|
||||
package_dir={"": "lib"},
|
||||
scripts=["bin/svtplay-dl"],
|
||||
entry_points={
|
||||
"console_scripts": [
|
||||
"svtplay-dl = svtplay_dl:main",
|
||||
],
|
||||
},
|
||||
author="Johan Andersson",
|
||||
author_email="j@i19.se",
|
||||
description="Command-line program to download videos from various video on demand sites",
|
||||
|
Loading…
Reference in New Issue
Block a user