LOADING
stalk profile repost tiktok
const { execFileSync } = require("child_process");
const BASE_URL = "https://petdii.com";
function kirimRequest(username, jumlah, cursor) {
const body = JSON.stringify({ unique_id: username, count: jumlah, cursor });
const args = [
"-s", "-X", "POST",
`${BASE_URL}/api/tiktok/get-reposts`,
"-H", "accept: application/json, text/plain, */*",
"-H", "accept-language: id-ID,id;q=0.9,en-US;q=0.8,en;q=0.7",
"-H", "cache-control: no-cache",
"-H", "content-type: application/json",
"-H", "pragma: no-cache",
"-H", "referer: https://petdii.com/tiktok-repost-viewer",
"-H", 'user-agent: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Mobile Safari/537.36',
"-d", body,
];
const hasilRaw = execFileSync("curl", args, { encoding: "utf8" });
let respons;
try {
respons = JSON.parse(hasilRaw);
} catch {
throw new Error("Gagal parse JSON: " + hasilRaw.slice(0, 200));
}
if (respons.code !== 0) throw new Error(respons.msg || "Gagal ambil data");
return respons;
}
function ambilRepost(username, jumlah = 6, cursor = 0) {
const respons = kirimRequest(username, jumlah, cursor);
const { videos, cursor: cursorBaru, hasMore } = respons.data;
return {
username,
cursor: cursorBaru,
adaLagi: hasMore,
total: videos.length,
videos: videos.map((v) => ({
video_id: v.video_id,
aweme_id: v.aweme_id,
judul: v.title,
region: v.region,
durasi: v.duration,
cover: v.cover,
play_tanpa_watermark: v.play,
play_dengan_watermark: v.wmplay,
ukuran_bytes: v.size,
dibuat: new Date(v.create_time * 1000).toISOString(),
stats: {
ditonton: v.play_count,
disukai: v.digg_count,
komentar: v.comment_count,
dibagikan: v.share_count,
diunduh: v.download_count,
disimpan: v.collect_count,
},
pembuat: {
id: v.author.id,
username: v.author.unique_id,
nama: v.author.nickname,
foto: v.author.avatar,
},
musik_info: {
id: v.music_info.id,
judul: v.music_info.title,
artis: v.music_info.author,
play: v.music_info.play,
cover: v.music_info.cover,
durasi: v.music_info.duration,
original: v.music_info.original,
},
})),
};
}
function ambilSemuaRepost(username, maxHalaman = 5) {
let cursor = 0;
let adaLagi = true;
let halamanKe = 0;
let semuaVideo = [];
while (adaLagi && halamanKe < maxHalaman) {
const hasil = ambilRepost(username, 6, cursor);
semuaVideo = semuaVideo.concat(hasil.videos);
cursor = hasil.cursor;
adaLagi = hasil.adaLagi;
halamanKe++;
}
return {
username,
totalVideo: semuaVideo.length,
halamanDiambil: halamanKe,
adaLagiDiServer: adaLagi,
videos: semuaVideo,
};
}
if (require.main === module) {
const [, , username, mode] = process.argv;
if (!username) {
console.error("Pake: node ttrepost.js <username> [semua]");
console.error("Contoh: node ttrepost.js dimeh493");
console.error("Contoh: node ttrepost.js dimeh493 semua");
process.exit(1);
}
try {
const hasil = mode === "semua" ? ambilSemuaRepost(username) : ambilRepost(username);
console.log(JSON.stringify(hasil, null, 2));
} catch (err) {
console.error("Error:", err.message);
process.exit(1);
}
}
module.exports = { ambilRepost, ambilSemuaRepost };
// by ShanMolvyrbashnode ttrepost.js <username>