mirror of
https://github.com/imputnet/cobalt.git
synced 2025-12-16 04:58:53 +00:00
tiktok: use webapp-based downloading method (#503)
Signed-off-by: Damir Modyarov <otomir@yandex.ru> Co-authored-by: wukko <me@wukko.me>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { genericUserAgent } from "../config.js";
|
||||
import { cookie as tiktokCookie } from "../processing/services/tiktok.js";
|
||||
|
||||
const defaultHeaders = {
|
||||
'user-agent': genericUserAgent
|
||||
@@ -13,6 +14,9 @@ const serviceHeaders = {
|
||||
origin: 'https://www.youtube.com',
|
||||
referer: 'https://www.youtube.com',
|
||||
DNT: '?1'
|
||||
},
|
||||
tiktok: {
|
||||
cookie: tiktokCookie
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,5 +26,7 @@ export function closeResponse(res) {
|
||||
}
|
||||
|
||||
export function getHeaders(service) {
|
||||
return { ...defaultHeaders, ...serviceHeaders[service] }
|
||||
// Converting all header values to strings
|
||||
return Object.entries({ ...defaultHeaders, ...serviceHeaders[service] })
|
||||
.reduce((p, [key, val]) => ({ ...p, [key]: String(val) }), {})
|
||||
}
|
||||
Reference in New Issue
Block a user