diff --git a/main.py b/main.py
index b38dc85..4c9152f 100644
--- a/main.py
+++ b/main.py
@@ -19,10 +19,17 @@ class VideoWrapper:
self.likes = a["likes"]
self.dislikes = a["dislikes"]
+ self.embedPath = a["embedPath"]
+
self.resolutions = []
self.video = None
- for entry in a["files"]:
+ self.files = a["files"]
+ if len(self.files) == 0:
+ self.files = ((a["streamingPlaylists"])[0])["files"]
+
+
+ for entry in self.files:
resolution = (entry["resolution"])["id"]
self.resolutions.append(entry["resolution"])
@@ -67,11 +74,12 @@ async def search(domain, term):
async def video(domain, id):
data = peertube.video(domain, id)
quality = request.args.get("quality")
+ embed = request.args.get("embed")
if quality == None:
quality = "best"
vid = VideoWrapper(data, quality)
- return await render_template("video.html", video=vid, quality=quality)
+ return await render_template("video.html", video=vid, quality=quality, embed=embed)
if __name__ == "__main__":
diff --git a/templates/video.html b/templates/video.html
index 891e590..503c18c 100644
--- a/templates/video.html
+++ b/templates/video.html
@@ -5,9 +5,12 @@
By:
{{ video.channel.displayName }} ({{ video.channel.name }}@{{ video.channel.host }})
- {% if video.no_quality_selected %}
+ {% if video.no_quality_selected and not embed %}
Please select a resolution:
+ {% elif embed %} +