Skip to content

Commit 9c0267d

Browse files
committed
Fix issues with embed URLs
1 parent fa275e5 commit 9c0267d

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

vxtiktok.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from urllib.parse import quote, urljoin, urlparse
2+
import urllib.parse
23
from flask import Flask, render_template, request, redirect, send_file, abort
34
from yt_dlp import YoutubeDL
45
from flask_cors import CORS
@@ -11,6 +12,7 @@
1112
import base64
1213
import slideshowBuilder
1314
import html
15+
import urllib
1416
app = Flask(__name__)
1517
CORS(app)
1618

@@ -174,8 +176,9 @@ def embed_tiktok(post_link):
174176

175177
directURL = f"https://"+config.currentConfig["MAIN"]["domainName"]+"/vid/"+videoInfo["author"]["uniqueId"]+"/"+videoInfo["id"]#+".mp4"
176178
else:
177-
vFormat = {"width": 1280, "height": 720}
178-
directURL = "https://"+config.currentConfig["MAIN"]["domainName"]+"/slideshow.mp4?url="+post_link
179+
vFormat = {"width": 1280, "height": 720, "cover":videoInfo["slideshowData"]["imageURLs"][0]}
180+
encoded_url=urllib.parse.quote(post_link)
181+
directURL = "https://"+config.currentConfig["MAIN"]["domainName"]+"/slideshow.mp4?url="+encoded_url
179182
statsLine = quote(build_stats_line(videoInfo))
180183
return render_template('video.html', videoInfo=videoInfo, mp4URL=directURL, vFormat=vFormat, appname=config.currentConfig["MAIN"]["appName"], statsLine=statsLine, domainName=config.currentConfig["MAIN"]["domainName"],original_url = post_link)
181184

@@ -214,7 +217,8 @@ def slideshow():
214217
return "This is not a slideshow", 400
215218
if config.currentConfig["MAIN"]["slideshowRenderer"] != "local":
216219
renderer=config.currentConfig["MAIN"]["slideshowRenderer"] # this is a url to an api that should return raw mp4 data
217-
return redirect(f"{renderer}?url={url}",code=307)
220+
eurl=urllib.parse.quote(url)
221+
return redirect(f"{renderer}?url={eurl}",code=307)
218222
# render locally
219223
if config.currentConfig["MAIN"]["slideshowRenderer"] == "local":
220224
b64 = slideshowBuilder.generateVideo(slideshow)

0 commit comments

Comments
 (0)