add ph support
All checks were successful
continuous-integration/drone Build is passing

This commit is contained in:
Roy Olav Purser 2023-07-30 16:12:53 +02:00
parent e62327c64f
commit 65cec66bfe
Signed by: roypur
GPG Key ID: 90142918D5E59AD3
2 changed files with 4 additions and 1 deletions

View File

@ -27,6 +27,7 @@ providers["svt"] = "https://svtplay.se"
providers["youtube"] = "https://www.youtube.com/watch?v="
providers["twitch"] = "https://twitch.tv"
providers["twitter"] = "https://twitter.com"
providers["pornhub"] = "https://www.pornhub.com/view_video.php?viewkey="
nextcloud_server = os.environ.get("NEXTCLOUD_SERVER")
if nextcloud_server is not None:

View File

@ -67,7 +67,9 @@ class UpstreamHandler:
path = handler.request.path
if self.provider.startswith("nextcloud"):
path = path.removesuffix("/").removesuffix("download").removesuffix("/")
elif self.provider.startswith("youtube"):
elif self.provider.startswith("youtube") or self.provider.startswith(
"pornhub"
):
path = path.removeprefix("/")
self.upstream = config.providers[self.provider] + path
if not self.direct: