-
Notifications
You must be signed in to change notification settings - Fork 2
fix tiktok bot media urls #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -9,9 +9,12 @@ const FOLLOWUP_RE = | |
|
|
||
| async function parseMedia(raw: Record<string, any>): Promise<NormalizedPost["media"]> { | ||
| if (raw.video) { | ||
| const urls = raw.video.PlayAddrStruct?.UrlList ?? []; | ||
| const videoURL = urls.find((url: string) => url.includes("/aweme/v1/play/")) ?? urls[0]; | ||
| if (videoURL) return [{ url: videoURL, type: "video" }]; | ||
| const urls = [ | ||
| raw.video.playAddr, | ||
| raw.video.downloadAddr, | ||
| ...(raw.video.PlayAddrStruct?.UrlList ?? []), | ||
| ].filter((url) => typeof url === "string" && url.length > 0); | ||
| return [...new Set(urls)].map((url) => ({ url, type: "video" })); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [🟡 Medium] [🔵 Bug] The transform now maps every candidate video URL into a distinct // packages/platforms/src/platforms/tiktok.ts
const urls = [
raw.video.playAddr,
raw.video.downloadAddr,
...(raw.video.PlayAddrStruct?.UrlList ?? []),
];
return [...new Set(urls)].map((url) => ({ url, type: "video" })); |
||
| } | ||
| return []; | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[🟠 High] [🔵 Bug]
resolveMediaperforms a network fetch for each TikTok candidate insidebuildEmbedbut does not catch fetch/cancel exceptions, so transient network failures (DNS/TLS/socket reset) throw out of embed construction and fail the request instead of degrading gracefully. This turns a best-effort media URL refinement step into a hard failure path; wrap the probe intry/catchand continue with the original item (or skip it) on error.