mirror of
https://github.com/imputnet/cobalt.git
synced 2025-07-18 11:18:28 +00:00
tiktok: use new cookie for each request
This commit is contained in:
parent
6f016e7c29
commit
b03d8c74ff
@ -4,9 +4,9 @@ import { extract } from "../url.js";
|
|||||||
import Cookie from "../cookie/cookie.js";
|
import Cookie from "../cookie/cookie.js";
|
||||||
|
|
||||||
const shortDomain = "https://vt.tiktok.com/";
|
const shortDomain = "https://vt.tiktok.com/";
|
||||||
export const cookie = new Cookie({});
|
|
||||||
|
|
||||||
export default async function(obj) {
|
export default async function(obj) {
|
||||||
|
const cookie = new Cookie({});
|
||||||
let postId = obj.postId;
|
let postId = obj.postId;
|
||||||
|
|
||||||
if (!postId) {
|
if (!postId) {
|
||||||
@ -75,32 +75,46 @@ export default async function(obj) {
|
|||||||
if (audio.includes("mime_type=audio_mpeg")) bestAudio = 'mp3';
|
if (audio.includes("mime_type=audio_mpeg")) bestAudio = 'mp3';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (video) return {
|
if (video) {
|
||||||
urls: video,
|
return {
|
||||||
filename: videoFilename
|
urls: video,
|
||||||
|
filename: videoFilename,
|
||||||
|
headers: { cookie }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (images && obj.isAudioOnly) return {
|
|
||||||
urls: audio,
|
if (images && obj.isAudioOnly) {
|
||||||
audioFilename: audioFilename,
|
return {
|
||||||
isAudioOnly: true,
|
urls: audio,
|
||||||
bestAudio
|
audioFilename: audioFilename,
|
||||||
|
isAudioOnly: true,
|
||||||
|
bestAudio,
|
||||||
|
headers: { cookie }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 => ({ url }))
|
.map(url => ({ url }));
|
||||||
|
|
||||||
return {
|
return {
|
||||||
picker: imageLinks,
|
picker: imageLinks,
|
||||||
urls: audio,
|
urls: audio,
|
||||||
audioFilename: audioFilename,
|
audioFilename: audioFilename,
|
||||||
isAudioOnly: true,
|
isAudioOnly: true,
|
||||||
bestAudio
|
bestAudio,
|
||||||
|
headers: { cookie }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (audio) return {
|
|
||||||
urls: audio,
|
if (audio) {
|
||||||
audioFilename: audioFilename,
|
return {
|
||||||
isAudioOnly: true,
|
urls: audio,
|
||||||
bestAudio
|
audioFilename: audioFilename,
|
||||||
|
isAudioOnly: true,
|
||||||
|
bestAudio,
|
||||||
|
headers: { cookie }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
import { genericUserAgent } from "../config.js";
|
import { genericUserAgent } from "../config.js";
|
||||||
import { cookie as tiktokCookie } from "../processing/services/tiktok.js";
|
|
||||||
|
|
||||||
const defaultHeaders = {
|
const defaultHeaders = {
|
||||||
'user-agent': genericUserAgent
|
'user-agent': genericUserAgent
|
||||||
@ -14,9 +13,6 @@ const serviceHeaders = {
|
|||||||
origin: 'https://www.youtube.com',
|
origin: 'https://www.youtube.com',
|
||||||
referer: 'https://www.youtube.com',
|
referer: 'https://www.youtube.com',
|
||||||
DNT: '?1'
|
DNT: '?1'
|
||||||
},
|
|
||||||
tiktok: {
|
|
||||||
cookie: tiktokCookie
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user