Skip to content

Commit 4ed4e8c

Browse files
committed
Fix for iOS playback
1 parent 13de354 commit 4ed4e8c

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

vxtiktok-cf-worker-proxy/src/index.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,17 @@ async function handleRequest(request) {
66
const url = new URL(request.url)
77
const path = url.pathname
88

9-
const match = path.match(/^\/vid\/([^\/]+)\/([^\/]+)\.mp4$/)
9+
let match = path.match(/^\/vid\/([^\/]+)\/([^\/]+)$/)
1010
if (!match) {
1111
return new Response('Invalid URL format', { status: 400 })
1212
}
1313

1414
const author = match[1]
15-
const vid = match[2]
15+
let vid = match[2]
16+
17+
if (vid.endsWith('.mp4')) {
18+
vid = vid.slice(0, -4)
19+
}
1620

1721
const postLink = `https://www.tiktok.com/@${author}/video/${vid}`
1822
const videoData = await downloadVideoFromPostURL(postLink)

vxtiktok.py

+4-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ def embed_tiktok(post_link):
173173
if "slideshowData" not in videoInfo or videoInfo["slideshowData"] == None:
174174
vFormat = findApiFormat(videoInfo)
175175

176-
directURL = f"https://"+config.currentConfig["MAIN"]["domainName"]+"/vid/"+videoInfo["author"]["uniqueId"]+"/"+videoInfo["id"]+".mp4"
176+
directURL = f"https://"+config.currentConfig["MAIN"]["domainName"]+"/vid/"+videoInfo["author"]["uniqueId"]+"/"+videoInfo["id"]#+".mp4"
177177
else:
178178
vFormat = {"width": 1280, "height": 720}
179179
directURL = "https://"+config.currentConfig["MAIN"]["domainName"]+"/slideshow.mp4?url="+post_link
@@ -184,8 +184,10 @@ def embed_tiktok(post_link):
184184
def main():
185185
return redirect(config.currentConfig["MAIN"]["repoURL"])
186186

187-
@app.route('/vid/<author>/<vid>.mp4')
187+
@app.route('/vid/<author>/<vid>')
188188
def video(author, vid):
189+
if vid.endswith(".mp4"):
190+
vid = vid[:-4]
189191
post_link = f"https://www.tiktok.com/@{author}/video/{vid}"
190192
videoData = downloadVideoFromPostURL(post_link)
191193
if videoData == None:

0 commit comments

Comments
 (0)