1
0
mirror of https://github.com/spaam/svtplay-dl.git synced 2024-11-27 05:34:15 +01:00

Compare commits

...

8 Commits

Author SHA1 Message Date
I'm an OSK user, are you?
9d1baaa88d
Merge cafdfba356 into 85d93464e2 2024-10-23 18:51:17 +02:00
Carl Christerson
85d93464e2 Avoid overwrite config for merge subtitle 2024-10-06 19:45:26 +02:00
Patrik Lermon
515ab99c7a tv4play: update Client-Version from 4.0.0 to 5.2.0 2024-10-05 23:18:58 +02:00
Johan Andersson
757be3c748 setup: spelling is hard 2024-07-29 10:29:08 +02:00
Johan Andersson
905b6d82b7 urplay: improve --all-episodes 2024-07-29 00:05:59 +02:00
Johan Andersson
b49d5f232a sr: fix support for music files via language argument 2024-07-29 00:05:59 +02:00
Johan Andersson
be2e1bcb31 setup: use entry point instead of scripts 2024-07-29 00:05:41 +02:00
Sopor
cafdfba356
Update bug_report.md
Templates are now moved in to a folder called ISSUE_TEMPLATE
2020-02-06 01:31:24 +01:00
8 changed files with 105 additions and 23 deletions

70
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View 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 -->
:

View File

@ -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")

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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.")

View File

@ -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:

View File

@ -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",