Compare commits
No commits in common. "3040a8f320bb7af675bf032d87386e4ade64e613" and "0b47bda1aa2804d79d70036c400833ac5ebed750" have entirely different histories.
3040a8f320
...
0b47bda1aa
|
@ -34,11 +34,6 @@ $ python3 main.py ::1 7171 # Also works with IPv6 addresses
|
|||
|
||||
It is strongly disrecommended to run the production using this command. Instead, please refer to the [Quart deployment docs](https://pgjones.gitlab.io/quart/tutorials/deployment.html).
|
||||
|
||||
## TODO-Tracker
|
||||
|
||||
We have our TODO-Tracker hosted on todo.sr.ht: [SimpleerTube](https://todo.sr.ht/~metalune/SimpleerTube)
|
||||
|
||||
## License
|
||||
|
||||
This software is distributed under the AGPLv3 license. You can find a copy in the [LICENSE](LICENSE) file.
|
||||
|
||||
|
|
9
main.py
9
main.py
|
@ -415,14 +415,7 @@ async def video_channels__about(domain, name):
|
|||
@app.route("/<string:domain>/videos/watch/<string:id>/<string:lang>.vtt")
|
||||
async def subtitles(domain, id, lang):
|
||||
try:
|
||||
captions = peertube.video_captions(domain, id)
|
||||
for entry in captions["data"]:
|
||||
if entry["language"]["id"] == lang: return peertube.video_captions_download(domain, entry["captionPath"].split('/')[-1])
|
||||
return await render_template(
|
||||
"error.html",
|
||||
error_number = "404",
|
||||
error_reason = "This video has no subtitles/captions inthe requested language"
|
||||
), 404
|
||||
return peertube.video_captions_download(domain, id, lang)
|
||||
except Exception as e:
|
||||
return await render_template(
|
||||
"error.html",
|
||||
|
|
|
@ -26,11 +26,10 @@ def video_captions(domain, id):
|
|||
url = "https://" + domain + "/api/v1/videos/" + id + "/captions"
|
||||
return json.loads(requests.get(url).text)
|
||||
|
||||
def video_captions_download(domain, caption_id):
|
||||
def video_captions_download(domain, id, lang):
|
||||
# URL is hardcoded to prevent further proxying. URL may change with updates, see captions API
|
||||
# eg. https://kolektiva.media/api/v1/videos/9c9de5e8-0a1e-484a-b099-e80766180a6d/captions
|
||||
# TODO: What if the captionPath doesn't follow this format on an instance? Should we really proxy ANYTHING returned by API?
|
||||
url = "https://" + domain + "/lazy-static/video-captions/" + caption_id
|
||||
url = "https://" + domain + "/lazy-static/video-captions/" + id + '-' + lang + ".vtt"
|
||||
return requests.get(url).text
|
||||
|
||||
def search(domain, term, start=0, count=10):
|
||||
|
|
|
@ -11,12 +11,7 @@
|
|||
|
||||
<body>
|
||||
<center>
|
||||
|
||||
<h2>{{ instance_name }}</h2>
|
||||
<a href="/">Home</a>
|
||||
<b> | </b>
|
||||
<a href="/{{ domain }}">Instance Home</a>
|
||||
|
||||
<form action="/{{ domain }}/search" method="POST">
|
||||
<input size="45" style="max-width: 100%" type="text" name="query" id="query" placeholder="Search" value="{{ search_term }}"/>
|
||||
<button type="submit">Search</button>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<br>
|
||||
{{ video.views }} Views
|
||||
<br>
|
||||
<a href="/{{ domain }}/video-channels/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<a href="/{{ domain }}/accounts/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<b>{{ video.channel.displayName }}</b>
|
||||
</a>
|
||||
<br>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<br>
|
||||
{{ video.views }} Views
|
||||
<br>
|
||||
<a href="/{{ domain }}/video-channels/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<a href="/{{ domain }}/accounts/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<b>{{ video.channel.displayName }}</b>
|
||||
</a>
|
||||
<br>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<br>
|
||||
{{ video.views }} Views
|
||||
<br>
|
||||
<a href="/{{ domain }}/video-channels/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<a href="/{{ domain }}/accounts/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<b>{{ video.channel.displayName }}</b>
|
||||
</a>
|
||||
<br>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<br>
|
||||
{{ video.views }} Views
|
||||
<br>
|
||||
<a href="/{{ domain }}/video-channels/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<a href="/{{ domain }}/accounts/{{ video.channel.name }}@{{ video.channel.host }}">
|
||||
<b>{{ video.channel.displayName }}</b>
|
||||
</a>
|
||||
<br>
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
<br>
|
||||
{{ result.views }} Views
|
||||
<br>
|
||||
<a href="/{{ domain }}/video-channels/{{ result.channel.name }}@{{ result.channel.host }}">
|
||||
<a href="/{{ domain }}/accounts/{{ result.channel.name }}@{{ result.channel.host }}">
|
||||
<b>{{ result.channel.displayName }}</b>
|
||||
</a>
|
||||
<br>
|
||||
|
|
Loading…
Reference in New Issue