api/tiktok: add support for proxying images in a picker
This commit is contained in:
parent
0852f5dc09
commit
f464d87585
2 changed files with 16 additions and 5 deletions
|
@ -128,7 +128,8 @@ export default async function(host, patternMatch, obj) {
|
||||||
id: patternMatch.id,
|
id: patternMatch.id,
|
||||||
fullAudio: obj.tiktokFullAudio,
|
fullAudio: obj.tiktokFullAudio,
|
||||||
isAudioOnly,
|
isAudioOnly,
|
||||||
h265: obj.tiktokH265
|
h265: obj.tiktokH265,
|
||||||
|
alwaysProxy: obj.alwaysProxy,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import Cookie from "../cookie/cookie.js";
|
||||||
import { extract } from "../url.js";
|
import { extract } from "../url.js";
|
||||||
import { genericUserAgent } from "../../config.js";
|
import { genericUserAgent } from "../../config.js";
|
||||||
import { updateCookie } from "../cookie/manager.js";
|
import { updateCookie } from "../cookie/manager.js";
|
||||||
|
import { createStream } from "../../stream/manage.js";
|
||||||
|
|
||||||
const shortDomain = "https://vt.tiktok.com/";
|
const shortDomain = "https://vt.tiktok.com/";
|
||||||
|
|
||||||
|
@ -97,10 +98,19 @@ export default async function(obj) {
|
||||||
if (images) {
|
if (images) {
|
||||||
let imageLinks = images
|
let imageLinks = images
|
||||||
.map(i => i.imageURL.urlList.find(p => p.includes(".jpeg?")))
|
.map(i => i.imageURL.urlList.find(p => p.includes(".jpeg?")))
|
||||||
.map(url => ({
|
.map((url, i) => {
|
||||||
|
if (obj.alwaysProxy) url = createStream({
|
||||||
|
service: "tiktok",
|
||||||
|
type: "proxy",
|
||||||
|
u: url,
|
||||||
|
filename: `${filenameBase}_photo_${i + 1}.jpg`
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
type: "photo",
|
type: "photo",
|
||||||
url
|
url
|
||||||
}));
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return {
|
return {
|
||||||
picker: imageLinks,
|
picker: imageLinks,
|
||||||
|
|
Loading…
Reference in a new issue