mirror of
https://github.com/wukko/cobalt.git
synced 2024-11-15 04:39:58 +00:00
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,
|
||||
fullAudio: obj.tiktokFullAudio,
|
||||
isAudioOnly,
|
||||
h265: obj.tiktokH265
|
||||
h265: obj.tiktokH265,
|
||||
alwaysProxy: obj.alwaysProxy,
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ import Cookie from "../cookie/cookie.js";
|
|||
import { extract } from "../url.js";
|
||||
import { genericUserAgent } from "../../config.js";
|
||||
import { updateCookie } from "../cookie/manager.js";
|
||||
import { createStream } from "../../stream/manage.js";
|
||||
|
||||
const shortDomain = "https://vt.tiktok.com/";
|
||||
|
||||
|
@ -97,10 +98,19 @@ export default async function(obj) {
|
|||
if (images) {
|
||||
let imageLinks = images
|
||||
.map(i => i.imageURL.urlList.find(p => p.includes(".jpeg?")))
|
||||
.map(url => ({
|
||||
type: "photo",
|
||||
url
|
||||
}));
|
||||
.map((url, i) => {
|
||||
if (obj.alwaysProxy) url = createStream({
|
||||
service: "tiktok",
|
||||
type: "proxy",
|
||||
u: url,
|
||||
filename: `${filenameBase}_photo_${i + 1}.jpg`
|
||||
})
|
||||
|
||||
return {
|
||||
type: "photo",
|
||||
url
|
||||
}
|
||||
});
|
||||
|
||||
return {
|
||||
picker: imageLinks,
|
||||
|
|
Loading…
Reference in a new issue