abot-scraper 1.6.0 → 1.6.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.MD +208 -49
- package/dist/index.cjs +114 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -23
- package/dist/index.d.ts +6 -23
- package/dist/index.js +114 -214
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
package/dist/index.js
CHANGED
@@ -130,7 +130,7 @@ var Downloader = class {
|
|
130
130
|
};
|
131
131
|
this.generator = new Generator();
|
132
132
|
}
|
133
|
-
async
|
133
|
+
async facebookDownloader(url) {
|
134
134
|
try {
|
135
135
|
const headers = {
|
136
136
|
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0",
|
@@ -209,72 +209,52 @@ var Downloader = class {
|
|
209
209
|
};
|
210
210
|
}
|
211
211
|
}
|
212
|
-
async
|
213
|
-
const payload = {
|
214
|
-
username
|
215
|
-
};
|
216
|
-
const headers = {
|
217
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/",
|
218
|
-
accept: "application/json, text/plain, */*",
|
219
|
-
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
220
|
-
"content-type": "application/json",
|
221
|
-
priority: "u=1, i",
|
222
|
-
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
223
|
-
"sec-ch-ua-mobile": "?0",
|
224
|
-
"sec-ch-ua-platform": '"Windows"',
|
225
|
-
"sec-fetch-dest": "empty",
|
226
|
-
"sec-fetch-mode": "cors",
|
227
|
-
"sec-fetch-site": "same-origin",
|
228
|
-
Referer: "https://storyviewer.com/",
|
229
|
-
"Referrer-Policy": "strict-origin-when-cross-origin"
|
230
|
-
};
|
212
|
+
async instagramDownloader(url) {
|
231
213
|
try {
|
214
|
+
const payload = new URLSearchParams({ url });
|
215
|
+
const headers = {
|
216
|
+
accept: "*/*",
|
217
|
+
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
218
|
+
"content-type": "application/x-www-form-urlencoded",
|
219
|
+
priority: "u=1, i",
|
220
|
+
"sec-ch-ua": '"Not)A;Brand";v="8", "Chromium";v="138", "Microsoft Edge";v="138"',
|
221
|
+
"sec-ch-ua-mobile": "?0",
|
222
|
+
"sec-ch-ua-platform": '"Windows"',
|
223
|
+
"sec-fetch-dest": "empty",
|
224
|
+
"sec-fetch-mode": "cors",
|
225
|
+
"sec-fetch-site": "same-origin"
|
226
|
+
};
|
232
227
|
const response = await axios.post(
|
233
|
-
|
228
|
+
"https://snapinsta.llc/process",
|
234
229
|
payload,
|
235
230
|
{ headers }
|
236
231
|
);
|
237
|
-
const
|
238
|
-
const
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
232
|
+
const $ = cheerio.load(response.data);
|
233
|
+
const downloadItems = [];
|
234
|
+
$(".download-item").each((_index, element) => {
|
235
|
+
const $element = $(element);
|
236
|
+
const previewImg = $element.find(".media-box img").attr("src");
|
237
|
+
const downloadLink = $element.find(".download-media").attr("href");
|
238
|
+
const downloadText = $element.find(".download-media").text().trim();
|
239
|
+
const isVideo = downloadText.toLowerCase().includes("video") || $element.find(".icon-downvid").length > 0;
|
240
|
+
if (downloadLink) {
|
241
|
+
const mediaItem = {
|
242
|
+
type: isVideo ? "video" : "image",
|
243
|
+
url: downloadLink
|
244
|
+
};
|
245
|
+
if (previewImg) {
|
246
|
+
mediaItem.preview = previewImg;
|
247
|
+
}
|
248
|
+
downloadItems.push(mediaItem);
|
245
249
|
}
|
246
|
-
};
|
247
|
-
} catch (error) {
|
248
|
-
return {
|
249
|
-
creator: global.creator,
|
250
|
-
status: false,
|
251
|
-
msg: error instanceof Error ? error.message : "Unknown error"
|
252
|
-
};
|
253
|
-
}
|
254
|
-
}
|
255
|
-
async instagram(url) {
|
256
|
-
try {
|
257
|
-
const config = new URLSearchParams({
|
258
|
-
url,
|
259
|
-
new: "2",
|
260
|
-
lang: "en",
|
261
|
-
app: ""
|
262
250
|
});
|
263
|
-
|
264
|
-
|
265
|
-
}
|
266
|
-
const response = await axios.post(
|
267
|
-
"https://snapinsta.app/get-data.php",
|
268
|
-
config,
|
269
|
-
{ headers }
|
270
|
-
);
|
271
|
-
const downloadLinks = response.data.files.map(
|
272
|
-
(file) => file.__type === "GraphVideo" ? { type: "video", url: file.video_url || "" } : file.__type === "GraphImage" ? { type: "image", url: file.download_url || "" } : null
|
273
|
-
).filter((link) => link !== null);
|
251
|
+
if (downloadItems.length === 0) {
|
252
|
+
throw new Error("No media items found in the response.");
|
253
|
+
}
|
274
254
|
return {
|
275
255
|
creator: global.creator,
|
276
256
|
status: 200,
|
277
|
-
result:
|
257
|
+
result: downloadItems
|
278
258
|
};
|
279
259
|
} catch (error) {
|
280
260
|
return {
|
@@ -285,60 +265,6 @@ var Downloader = class {
|
|
285
265
|
}
|
286
266
|
}
|
287
267
|
async youtubeDownloader(url) {
|
288
|
-
try {
|
289
|
-
const config = qs.stringify({
|
290
|
-
url,
|
291
|
-
q_auto: 0,
|
292
|
-
ajax: 1,
|
293
|
-
lang: "en"
|
294
|
-
});
|
295
|
-
const headers = {
|
296
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
297
|
-
};
|
298
|
-
const response = await axios.post(
|
299
|
-
"https://yt1s.net/ajax?retry=undefined&platform=youtube",
|
300
|
-
config,
|
301
|
-
{ headers }
|
302
|
-
);
|
303
|
-
const $ = cheerio.load(response.data.result);
|
304
|
-
const title = $(".caption b").text().trim();
|
305
|
-
const downloadLinks = {
|
306
|
-
"480p": $('a[data-fquality="480p"]').attr("href") || "",
|
307
|
-
"720p": $('a[data-fquality="720p"]').attr("href") || "",
|
308
|
-
"1080p": $('a[data-fquality="1080p"]').attr("href") || ""
|
309
|
-
};
|
310
|
-
const thumbnailUrl = $(".thumbnail.cover img").attr("src");
|
311
|
-
const mp3ConvertElement = $("#convert-mp3 a");
|
312
|
-
const hrefAttr = mp3ConvertElement.attr("href");
|
313
|
-
if (!hrefAttr) throw new Error("MP3 conversion link not found.");
|
314
|
-
const mp3ConvertTokenMatch = hrefAttr.match(
|
315
|
-
/mp3_convert_task\('(\d+)',\s*'([^']+)'\)/
|
316
|
-
);
|
317
|
-
if (!mp3ConvertTokenMatch)
|
318
|
-
throw new Error("MP3 conversion token not found.");
|
319
|
-
const mp3ConvertToken = mp3ConvertTokenMatch[2];
|
320
|
-
const mp3Response = await axios.get(
|
321
|
-
`https://api.fabdl.com/youtube/mp3-convert-task?token=${mp3ConvertToken}`
|
322
|
-
);
|
323
|
-
return {
|
324
|
-
creator: global.creator,
|
325
|
-
status: 200,
|
326
|
-
result: {
|
327
|
-
title,
|
328
|
-
thumbnail: thumbnailUrl || "",
|
329
|
-
downloadLinks,
|
330
|
-
mp3DownloadUrl: `https://api.fabdl.com${mp3Response.data.result.download_url}`
|
331
|
-
}
|
332
|
-
};
|
333
|
-
} catch (error) {
|
334
|
-
return {
|
335
|
-
creator: global.creator,
|
336
|
-
status: false,
|
337
|
-
msg: error instanceof Error ? error.message : "Unknown error"
|
338
|
-
};
|
339
|
-
}
|
340
|
-
}
|
341
|
-
async youtubeDownloaderV2(url) {
|
342
268
|
try {
|
343
269
|
const timestamp = this.generator.generateTimeStampYoutubeDL();
|
344
270
|
const footer = this.generator.generateFooterYoutubeDL(timestamp, url);
|
@@ -437,76 +363,6 @@ import * as cheerio2 from "cheerio";
|
|
437
363
|
global.creator = "@abotscraper \u2013 ahmuq";
|
438
364
|
var Search = class {
|
439
365
|
constructor() {
|
440
|
-
this.ytPlay = (text) => {
|
441
|
-
return new Promise((resolve, reject) => {
|
442
|
-
const configd = {
|
443
|
-
k_query: text,
|
444
|
-
k_page: "mp3",
|
445
|
-
q_auto: 1
|
446
|
-
};
|
447
|
-
const headerss = {
|
448
|
-
"sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
449
|
-
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
450
|
-
Cookie: 'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}'
|
451
|
-
};
|
452
|
-
axios2("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
453
|
-
method: "POST",
|
454
|
-
data: new URLSearchParams(Object.entries(configd)),
|
455
|
-
headers: headerss
|
456
|
-
}).then(({ data }) => {
|
457
|
-
const v = data.vitems;
|
458
|
-
const v2 = v[Math.floor(Math.random() * v.length)].v;
|
459
|
-
const url = "https://www.youtube.com/watch?v=" + v2;
|
460
|
-
const config = {
|
461
|
-
k_query: "https://www.youtube.be/" + url,
|
462
|
-
k_page: "mp3",
|
463
|
-
hl: "en",
|
464
|
-
q_auto: 1
|
465
|
-
};
|
466
|
-
axios2("https://www.y2mate.com/mates/en68/analyze/ajax", {
|
467
|
-
method: "POST",
|
468
|
-
data: new URLSearchParams({
|
469
|
-
url: "https://www.youtube.be/" + url,
|
470
|
-
q_auto: "0",
|
471
|
-
ajax: "1"
|
472
|
-
}),
|
473
|
-
headers: headerss
|
474
|
-
}).then(({ data: data2 }) => {
|
475
|
-
const $ = cheerio2.load(data2.result);
|
476
|
-
const img = $("div.thumbnail.cover > a > img").attr("src");
|
477
|
-
axios2("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
478
|
-
method: "POST",
|
479
|
-
data: new URLSearchParams(Object.entries(config)),
|
480
|
-
headers: headerss
|
481
|
-
}).then(({ data: data3 }) => {
|
482
|
-
const convertConfig = {
|
483
|
-
vid: data3.vid,
|
484
|
-
k: data3.links.mp3.mp3128.k
|
485
|
-
};
|
486
|
-
const size = data3.links.mp3.mp3128.size;
|
487
|
-
axios2("https://www.y2mate.com/mates/convertV2/index", {
|
488
|
-
method: "POST",
|
489
|
-
data: new URLSearchParams(Object.entries(convertConfig)),
|
490
|
-
headers: headerss
|
491
|
-
}).then((response) => {
|
492
|
-
resolve({
|
493
|
-
creator: global.creator,
|
494
|
-
status: 200,
|
495
|
-
result: {
|
496
|
-
status: response.data.status,
|
497
|
-
title: response.data.title,
|
498
|
-
ftype: response.data.ftype,
|
499
|
-
thumb: img || "",
|
500
|
-
size_mp3: size,
|
501
|
-
link: response.data.dlink
|
502
|
-
}
|
503
|
-
});
|
504
|
-
}).catch(reject);
|
505
|
-
});
|
506
|
-
});
|
507
|
-
}).catch(reject);
|
508
|
-
});
|
509
|
-
};
|
510
366
|
this.wallpaper = (title, page = "1") => {
|
511
367
|
return new Promise((resolve, reject) => {
|
512
368
|
axios2.get(
|
@@ -561,6 +417,49 @@ var Search = class {
|
|
561
417
|
});
|
562
418
|
};
|
563
419
|
}
|
420
|
+
async igStory(username) {
|
421
|
+
const payload = {
|
422
|
+
username
|
423
|
+
};
|
424
|
+
const headers = {
|
425
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/",
|
426
|
+
accept: "application/json, text/plain, */*",
|
427
|
+
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
428
|
+
"content-type": "application/json",
|
429
|
+
priority: "u=1, i",
|
430
|
+
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
431
|
+
"sec-ch-ua-mobile": "?0",
|
432
|
+
"sec-ch-ua-platform": '"Windows"',
|
433
|
+
"sec-fetch-dest": "empty",
|
434
|
+
"sec-fetch-mode": "cors",
|
435
|
+
"sec-fetch-site": "same-origin",
|
436
|
+
Referer: "https://storyviewer.com/",
|
437
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
438
|
+
};
|
439
|
+
try {
|
440
|
+
const response = await axios2.post(
|
441
|
+
`https://storyviewer.com/api/data`,
|
442
|
+
payload,
|
443
|
+
{ headers }
|
444
|
+
);
|
445
|
+
const data = response.data;
|
446
|
+
const sources = data.stories.map((story) => story.source);
|
447
|
+
return {
|
448
|
+
creator: global.creator,
|
449
|
+
status: 200,
|
450
|
+
result: {
|
451
|
+
user_info: data.user_info,
|
452
|
+
links: sources
|
453
|
+
}
|
454
|
+
};
|
455
|
+
} catch (error) {
|
456
|
+
return {
|
457
|
+
creator: global.creator,
|
458
|
+
status: false,
|
459
|
+
msg: error instanceof Error ? error.message : "Unknown error"
|
460
|
+
};
|
461
|
+
}
|
462
|
+
}
|
564
463
|
async sfileSearch(query, page = 1) {
|
565
464
|
try {
|
566
465
|
const response = await axios2.get(
|
@@ -648,63 +547,64 @@ var Tools = class {
|
|
648
547
|
constructor() {
|
649
548
|
this.removeBackground = (image) => {
|
650
549
|
return new Promise((resolve, reject) => {
|
651
|
-
const
|
652
|
-
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
image
|
666
|
-
};
|
667
|
-
axios3.post("https://aibackgroundremover.org/api/remove-bg", payload, {
|
668
|
-
headers
|
669
|
-
}).then((CreateJobResponse) => {
|
670
|
-
if (CreateJobResponse.status !== 200) {
|
550
|
+
const form = new FormData();
|
551
|
+
form.append("image_file", image, "blob");
|
552
|
+
const productSerial = Generator.getFingerprint();
|
553
|
+
axios3.post("https://api.ezremove.ai/api/ez-remove/background-remove/create-job", form, {
|
554
|
+
headers: {
|
555
|
+
...form.getHeaders(),
|
556
|
+
"product-serial": productSerial,
|
557
|
+
"Referer": "https://ezremove.ai/",
|
558
|
+
"Origin": "https://ezremove.ai",
|
559
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36 Edg/138.0.0.0"
|
560
|
+
}
|
561
|
+
}).then((createJobResponse) => {
|
562
|
+
var _a, _b;
|
563
|
+
if (createJobResponse.data.code !== 1e5) {
|
671
564
|
reject({
|
672
565
|
creator: global.creator,
|
673
566
|
status: false,
|
674
|
-
error: `
|
567
|
+
error: `Job creation failed: ${((_a = createJobResponse.data.message) == null ? void 0 : _a.en) || ((_b = createJobResponse.data.message) == null ? void 0 : _b.id) || "Unknown error"}`
|
675
568
|
});
|
676
569
|
return;
|
677
570
|
}
|
678
|
-
const jobId =
|
679
|
-
const checkJobStatus = () => {
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
571
|
+
const jobId = createJobResponse.data.result.job_id;
|
572
|
+
const checkJobStatus = async () => {
|
573
|
+
try {
|
574
|
+
const jobResponse = await axios3.get(`https://api.ezremove.ai/api/ez-remove/background-remove/get-job/${jobId}`, {
|
575
|
+
headers: {
|
576
|
+
"authorization": "",
|
577
|
+
"product-serial": productSerial,
|
578
|
+
"Referer": "https://ezremove.ai/",
|
579
|
+
"Origin": "https://ezremove.ai"
|
580
|
+
}
|
581
|
+
});
|
582
|
+
const { code, result, message } = jobResponse.data;
|
583
|
+
if (code === 1e5 && result && result.output) {
|
684
584
|
resolve({
|
685
585
|
creator: global.creator,
|
686
586
|
status: true,
|
687
587
|
result: {
|
688
588
|
job_id: jobId,
|
689
|
-
image_url:
|
589
|
+
image_url: result.output[0]
|
690
590
|
}
|
691
591
|
});
|
692
|
-
} else if (
|
592
|
+
} else if (code === 300001) {
|
693
593
|
setTimeout(checkJobStatus, 3e3);
|
694
594
|
} else {
|
695
595
|
reject({
|
696
596
|
creator: global.creator,
|
697
597
|
status: false,
|
698
|
-
error: `
|
598
|
+
error: `Job failed: ${(message == null ? void 0 : message.en) || (message == null ? void 0 : message.id) || "Unknown error"} (Code: ${code})`
|
699
599
|
});
|
700
600
|
}
|
701
|
-
}
|
601
|
+
} catch (error) {
|
702
602
|
reject({
|
703
603
|
creator: global.creator,
|
704
604
|
status: false,
|
705
|
-
error: error.message
|
605
|
+
error: `Status check failed: ${error instanceof Error ? error.message : "Unknown error"}`
|
706
606
|
});
|
707
|
-
}
|
607
|
+
}
|
708
608
|
};
|
709
609
|
checkJobStatus();
|
710
610
|
}).catch((error) => {
|