x-downloader-scraper
v1.0.1
Published
downloader or scraper for X
Maintainers
Readme
download media from X/twitter via graphql
How to use?
this code based on ./test/test.js
import XD from 'x-downloader-scraper';
// Async function to run the test
async function runTest() {
const url = 'https://x.com/Eveveb_414/status/2017564730383327277?s=20'; // Example X post URL
const config = {
cookie: "", //set your cookie or leave it empty
authorization: "", //set your authorization or leave it empty
userAgent: "", //set your user agent or leave it empty
};
const proxy = null; // No proxy for this test
const result = await XD(url, config, proxy);
if (result.status === "error") {
console.error("Error:", result.message);
return;
}
console.log(JSON.stringify(result, null, 2));
}
// Run the test
runTest();Result
example results with all data
{
status: String,
data: {
author: {
name: String,
screen_name: String,
verified: Boolean,
bio: String,
location: String,
member_since: String,
profile_url: String,
avatar_url: String,
banner_url: String,
can_dm: Boolean || String, // String must be "unknown"
statistics: {
followers: Number,
following: Number,
favourites: Number,
listed_count: Number,
media_count: Number
}
},
statistics: {
favorites: Number,
bookmarks: Number,
quote_count: Number,
reply_count: Number,
retweet_count: Number
},
result: {
id: String,
created_at: String,
description: String,
language: String,
possibly_nsfw: Boolean,
media_count: Number,
media: [Array]
}
}
}Media result
...existing code
media: [
//Example for gif
{
type: "animated_gif",
quality: String,
thum: String,
url: String,
source: String
},
//Example for image
{
type: "photo",
source: String,
url: String
},
//example for Video
{
type: "video",
thumb: String,
source: String,
variants: [
{
bitrate: Number || null, //null if content_type is x-mpegURL
content_type: String,
url: String
},
]
}
]Error
{
status: "error",
message: String
}