Mengambil informasi data profile user Twitter
/**
* Judul : X (Twitter) Stalker
* Base URL : https://x.com
* Author : Cx99 - t.me/exploit99
* Deskripsi : Mengambil informasi data profil user X
* Channel : https://whatsapp.com/channel/0029VbCSF8sA89MopCVOYW06
*/
const axios = require('axios');
const cheerio = require('cheerio');
async function stalkX(username) {
username = username.replace(/^@/, '');
const url = `https://x.com/${username}`;
const headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8",
"accept-language": "en-US,en;q=0.9",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36",
"sec-fetch-dest": "document",
"sec-fetch-mode": "navigate",
"sec-fetch-site": "none",
"sec-fetch-user": "?1",
"upgrade-insecure-requests": "1"
};
try {
const response = await axios.get(url, { headers });
const html = response.data;
const $ = cheerio.load(html);
let profile = {
username: username,
name: "",
description: "",
avatar: "",
banner: "",
posts: "0",
joined: "",
followers: 0,
following: 0,
profile_url: url
};
$('meta').each((i, el) => {
const name = $(el).attr('name') || $(el).attr('property');
const content = $(el).attr('content');
if (name === 'profile:first_name') profile.name = content;
if (name === 'description') profile.description = content;
if (name === 'og:image') {
profile.avatar = content;
profile.avatar_hd = content.replace('_200x200', '').replace('_normal', '');
}
if (name === 'twitter:image' && content.includes('profile_banners')) {
profile.banner = content;
profile.banner_hd = content + "/1500x500";
}
if (name === 'twitter:data1') profile.posts = content;
if (name === 'twitter:data2') profile.joined = content;
});
const folMatch = html.match(/followers:(\d+),following:(\d+)/);
if (folMatch) {
profile.followers = parseInt(folMatch[1]);
profile.following = parseInt(folMatch[2]);
}
if (!profile.name && profile.followers === 0) {
return {
status: false,
message: "Data user tidak ditemukan. Pastikan username valid."
};
}
return {
status: true,
data: profile
};
} catch (error) {
return {
status: false,
message: `Gagal memproses data: ${error.message}`
};
}
}
module.exports = stalkX;
if (require.main === module) {
const args = process.argv.slice(2);
if (args.length === 0) {
console.log("? Penggunaan: node stalkx.js <username>");
console.log("? Contoh: node stalkx.js mrbeast");
process.exit(1);
}
const username = args[0];
stalkX(username)
.then(res => console.log(JSON.stringify(res, null, 2)))
.catch(err => console.error(err));
}