import got from "got"; import loc from "../../localization/manager.js"; import { genericUserAgent } from "../config.js"; import { unicodeDecode } from "../sub/utils.js"; let userAgent = genericUserAgent.split(' Chrome/1')[0] let config = { tiktok: { short: "https://vt.tiktok.com/", api: "https://api2.musical.ly/aweme/v1/feed/?aweme_id={postId}&version_code=262&app_name=musical_ly&channel=App&device_id=null&os_version=14.4.2&device_platform=iphone&device_type=iPhone9", // ill always find more endpoints lmfao }, douyin: { short: "https://v.douyin.com/", api: "https://www.iesdouyin.com/web/api/v2/aweme/iteminfo/?item_ids={postId}", } } function selector(j, h) { switch (h) { case "tiktok": return j["aweme_list"][0] case "douyin": return j['item_list'][0] } } export default async function(obj) { try { if (!obj.postId) { let html = await got.get(`${config[obj.host]["short"]}${obj.id}`, { followRedirect: false, headers: { "user-agent": userAgent } }); html = html.body; if (html.slice(0, 17) === '