abot-scraper 1.6.0 → 1.6.1
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 +80 -181
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -22
- package/dist/index.d.ts +5 -22
- package/dist/index.js +80 -181
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types/index.d.ts +1 -0
package/README.MD
CHANGED
@@ -1,6 +1,38 @@
|
|
1
1
|
# abot-scraper
|
2
2
|
|
3
|
-
A
|
3
|
+
A comprehensive scraper package for downloading content from social media platforms and performing AI-powered image processing tasks. Supports Facebook, TikTok, Instagram, YouTube, SFile downloads, plus advanced image enhancement and background removal tools.
|
4
|
+
|
5
|
+
## Features
|
6
|
+
|
7
|
+
### 📥 **Downloader**
|
8
|
+
|
9
|
+
- **Facebook**: Download videos from Facebook posts
|
10
|
+
- **TikTok**: Download videos from TikTok (watermark-free)
|
11
|
+
- **Instagram**: Download posts, stories, and reels
|
12
|
+
- **YouTube**: Download videos in multiple formats and quality options
|
13
|
+
- **YouTube MP3**: Download YouTube videos as MP3 audio files
|
14
|
+
- **SFile**: Download files from SFile sharing platform
|
15
|
+
|
16
|
+
### 🔍 **Search**
|
17
|
+
|
18
|
+
- **YouTube Search**: Find videos by keywords
|
19
|
+
- **Instagram Stories**: Get user's Instagram stories
|
20
|
+
- **Wallpaper Search**: Find high-quality wallpapers
|
21
|
+
- **Wikimedia Search**: Search for images and media from Wikimedia
|
22
|
+
- **SFile Search**: Search for files on SFile platform
|
23
|
+
|
24
|
+
### 🎨 **AI Tools**
|
25
|
+
|
26
|
+
- **Background Removal**: AI-powered background removal from images
|
27
|
+
- **Image Enhancement**: Enhance image quality using Remini AI (V1 & V2)
|
28
|
+
- **Image Upload**: Upload images and get shareable URLs
|
29
|
+
|
30
|
+
### 🛠️ **Technical Features**
|
31
|
+
|
32
|
+
- **TypeScript Support**: Full type definitions included
|
33
|
+
- **Dual Package**: Works with both CommonJS and ES Modules
|
34
|
+
- **Error Handling**: Comprehensive error handling and validation
|
35
|
+
- **Modern Architecture**: Built with latest Node.js standards
|
4
36
|
|
5
37
|
## Installation
|
6
38
|
|
@@ -26,36 +58,74 @@ npm install github:ahlulmukh/abot-scraper
|
|
26
58
|
|
27
59
|
## Usage
|
28
60
|
|
29
|
-
###
|
61
|
+
### Quick Start Example
|
30
62
|
|
31
63
|
```javascript
|
32
|
-
|
33
|
-
const
|
64
|
+
const { Downloader, Search, Tools } = require('abot-scraper');
|
65
|
+
const fs = require('fs');
|
66
|
+
|
67
|
+
async function example() {
|
68
|
+
// Initialize classes
|
69
|
+
const downloader = new Downloader();
|
70
|
+
const search = new Search();
|
71
|
+
const tools = new Tools();
|
72
|
+
|
73
|
+
try {
|
74
|
+
// Download a TikTok video
|
75
|
+
const tiktokResult = await downloader.tiktokDownloader(
|
76
|
+
'https://vt.tiktok.com/ZSB2LtXQF/'
|
77
|
+
);
|
78
|
+
console.log('TikTok download:', tiktokResult);
|
79
|
+
|
80
|
+
// Search YouTube videos
|
81
|
+
const ytResults = await search.ytSearch('phonk music');
|
82
|
+
console.log('YouTube search results:', ytResults);
|
83
|
+
|
84
|
+
// Remove background from image
|
85
|
+
const bgRemoved = await tools.removeBackground(
|
86
|
+
'https://example.com/photo.jpg'
|
87
|
+
);
|
88
|
+
console.log('Background removed:', bgRemoved);
|
89
|
+
} catch (error) {
|
90
|
+
console.error('Error:', error.message);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
example();
|
95
|
+
```
|
96
|
+
|
97
|
+
### CommonJS (Node.js with require)
|
34
98
|
|
35
|
-
|
36
|
-
|
37
|
-
const
|
99
|
+
```javascript
|
100
|
+
// Import classes directly
|
101
|
+
const { Downloader, Search, Tools } = require('abot-scraper');
|
38
102
|
|
39
|
-
// Or import classes directly
|
40
|
-
const { Downloader, Search } = require('abot-scraper');
|
41
103
|
const downloader = new Downloader();
|
42
104
|
const search = new Search();
|
105
|
+
const tools = new Tools();
|
106
|
+
|
107
|
+
// Download a Facebook video
|
108
|
+
const result = await downloader.facebookDownloader(
|
109
|
+
'https://facebook.com/video/123'
|
110
|
+
);
|
111
|
+
const searchResult = await search.sfileSearch('query', 1);
|
43
112
|
```
|
44
113
|
|
45
114
|
### ES Modules (modern JavaScript/TypeScript)
|
46
115
|
|
47
116
|
```javascript
|
48
|
-
//
|
49
|
-
import
|
50
|
-
|
51
|
-
// Use the pre-instantiated classes
|
52
|
-
const result = await abot.downloader.facebook('https://facebook.com/video/123');
|
53
|
-
const searchResult = await abot.search.sfileSearch('query', 1);
|
117
|
+
// Import classes directly
|
118
|
+
import { Downloader, Search, Tools } from 'abot-scraper';
|
54
119
|
|
55
|
-
// Or import classes directly
|
56
|
-
import { Downloader, Search } from 'abot-scraper';
|
57
120
|
const downloader = new Downloader();
|
58
121
|
const search = new Search();
|
122
|
+
const tools = new Tools();
|
123
|
+
|
124
|
+
// Download a Facebook video
|
125
|
+
const result = await downloader.facebookDownloader(
|
126
|
+
'https://facebook.com/video/123'
|
127
|
+
);
|
128
|
+
const searchResult = await search.sfileSearch('query', 1);
|
59
129
|
```
|
60
130
|
|
61
131
|
### TypeScript
|
@@ -63,21 +133,22 @@ const search = new Search();
|
|
63
133
|
TypeScript declarations are included, providing full type safety and IntelliSense support:
|
64
134
|
|
65
135
|
```typescript
|
66
|
-
import
|
136
|
+
import {
|
67
137
|
Downloader,
|
68
138
|
Search,
|
139
|
+
Tools,
|
69
140
|
type ApiResponse,
|
70
141
|
type FacebookResult,
|
71
142
|
} from 'abot-scraper';
|
72
143
|
|
73
144
|
// TypeScript will provide full type checking and autocomplete
|
74
|
-
const
|
145
|
+
const downloader = new Downloader();
|
146
|
+
const result: ApiResponse<FacebookResult> = await downloader.facebookDownloader(
|
75
147
|
'https://facebook.com/video/123'
|
76
148
|
);
|
77
149
|
|
78
150
|
// Types are automatically inferred
|
79
|
-
const
|
80
|
-
const fbResult = await downloader.facebook('https://example.com'); // Return type is known
|
151
|
+
const fbResult = await downloader.facebookDownloader('https://example.com'); // Return type is known
|
81
152
|
```
|
82
153
|
|
83
154
|
## API Reference
|
@@ -88,21 +159,19 @@ The `Downloader` class provides methods to download content from various platfor
|
|
88
159
|
|
89
160
|
#### Available Methods
|
90
161
|
|
91
|
-
- `
|
162
|
+
- `facebookDownloader(url)` - Download Facebook videos
|
92
163
|
- `tiktokDownloader(url)` - Download TikTok videos
|
93
|
-
- `
|
94
|
-
- `igstory(username)` - Get Instagram stories for a user
|
164
|
+
- `instagramDownloader(url)` - Download Instagram posts/stories/reels
|
95
165
|
- `youtubeDownloader(url)` - Download YouTube videos with multiple formats
|
166
|
+
- `ytMp3Downloader(url)` - Download YouTube videos as MP3 audio
|
96
167
|
- `sfileDownloader(url)` - Download files from SFile
|
97
168
|
|
98
169
|
#### Example Usage
|
99
170
|
|
100
171
|
```javascript
|
101
|
-
//
|
102
|
-
const {
|
103
|
-
|
104
|
-
// ES Modules
|
105
|
-
import { downloader } from 'abot-scraper';
|
172
|
+
// Import the Downloader class
|
173
|
+
const { Downloader } = require('abot-scraper');
|
174
|
+
const downloader = new Downloader();
|
106
175
|
|
107
176
|
// Download YouTube video
|
108
177
|
const result = await downloader.youtubeDownloader(
|
@@ -112,17 +181,27 @@ console.log(result);
|
|
112
181
|
|
113
182
|
// Download TikTok video
|
114
183
|
const tiktokResult = await downloader.tiktokDownloader(
|
115
|
-
'https://tiktok.com
|
184
|
+
'https://vt.tiktok.com/ZSB2LtXQF/'
|
116
185
|
);
|
117
186
|
console.log(tiktokResult);
|
118
187
|
|
119
188
|
// Download Facebook video
|
120
|
-
const fbResult = await downloader.
|
189
|
+
const fbResult = await downloader.facebookDownloader(
|
190
|
+
'https://facebook.com/video/123'
|
191
|
+
);
|
121
192
|
console.log(fbResult);
|
122
193
|
|
123
|
-
//
|
124
|
-
const
|
125
|
-
|
194
|
+
// Download Instagram content
|
195
|
+
const igResult = await downloader.instagramDownloader(
|
196
|
+
'https://www.instagram.com/p/CK0tLXyAzEI/'
|
197
|
+
);
|
198
|
+
console.log(igResult);
|
199
|
+
|
200
|
+
// Download YouTube as MP3
|
201
|
+
const mp3Result = await downloader.ytMp3Downloader(
|
202
|
+
'https://youtu.be/H_z0t5NQs7U'
|
203
|
+
);
|
204
|
+
console.log(mp3Result);
|
126
205
|
```
|
127
206
|
|
128
207
|
### Search Class
|
@@ -131,31 +210,71 @@ The `Search` class provides methods to search for content across various platfor
|
|
131
210
|
|
132
211
|
#### Available Methods
|
133
212
|
|
134
|
-
- `
|
135
|
-
- `
|
213
|
+
- `ytSearch(query)` - Search YouTube videos by query
|
214
|
+
- `igStory(username)` - Get Instagram stories for a user
|
215
|
+
- `wallpaper(query, page?)` - Search for wallpapers
|
136
216
|
- `wikimedia(query)` - Search Wikimedia content
|
137
|
-
- `sfileSearch(query, page)` - Search SFile for files
|
217
|
+
- `sfileSearch(query, page?)` - Search SFile for files
|
138
218
|
|
139
219
|
#### Example Usage
|
140
220
|
|
141
221
|
```javascript
|
142
|
-
//
|
143
|
-
const {
|
144
|
-
|
145
|
-
// ES Modules
|
146
|
-
import { search } from 'abot-scraper';
|
222
|
+
// Import the Search class
|
223
|
+
const { Search } = require('abot-scraper');
|
224
|
+
const search = new Search();
|
147
225
|
|
148
226
|
// Search YouTube videos
|
149
|
-
const ytResults = await search.
|
227
|
+
const ytResults = await search.ytSearch('music video');
|
150
228
|
console.log(ytResults);
|
151
229
|
|
230
|
+
// Get Instagram stories
|
231
|
+
const igStories = await search.igStory('cristiano');
|
232
|
+
console.log(igStories);
|
233
|
+
|
152
234
|
// Search wallpapers
|
153
|
-
const wallpapers = await search.wallpaper('abstract art',
|
235
|
+
const wallpapers = await search.wallpaper('abstract art', 1);
|
154
236
|
console.log(wallpapers);
|
155
237
|
|
156
238
|
// Search Wikimedia
|
157
239
|
const wikimediaResults = await search.wikimedia('nature photos');
|
158
240
|
console.log(wikimediaResults);
|
241
|
+
|
242
|
+
// Search SFile
|
243
|
+
const sfileResults = await search.sfileSearch('Capcut Pro');
|
244
|
+
console.log(sfileResults);
|
245
|
+
```
|
246
|
+
|
247
|
+
### Tools Class
|
248
|
+
|
249
|
+
The `Tools` class provides utility methods for image processing and manipulation.
|
250
|
+
|
251
|
+
#### Available Methods
|
252
|
+
|
253
|
+
- `removeBackground(imageUrl)` - Remove background from an image using AI
|
254
|
+
- `reminiV1(buffer)` - Enhance image quality using Remini V1 API
|
255
|
+
- `reminiV2(buffer)` - Enhance image quality using Remini V2 API
|
256
|
+
- `uploadImage(buffer)` - Upload image and get a shareable URL
|
257
|
+
|
258
|
+
#### Example Usage
|
259
|
+
|
260
|
+
```javascript
|
261
|
+
// Import the Tools class
|
262
|
+
const { Tools } = require('abot-scraper');
|
263
|
+
const fs = require('fs');
|
264
|
+
const tools = new Tools();
|
265
|
+
|
266
|
+
// Remove background from image
|
267
|
+
const bgRemoved = await tools.removeBackground('https://example.com/image.jpg');
|
268
|
+
console.log(bgRemoved);
|
269
|
+
|
270
|
+
// Enhance image quality
|
271
|
+
const imageBuffer = fs.readFileSync('path/to/image.jpg');
|
272
|
+
const enhanced = await tools.reminiV1(imageBuffer);
|
273
|
+
console.log(enhanced);
|
274
|
+
|
275
|
+
// Upload image
|
276
|
+
const uploaded = await tools.uploadImage(imageBuffer);
|
277
|
+
console.log(uploaded);
|
159
278
|
```
|
160
279
|
|
161
280
|
### Error Handling
|
@@ -164,6 +283,7 @@ All methods return promises and should be wrapped in try-catch blocks or use `.c
|
|
164
283
|
|
165
284
|
```javascript
|
166
285
|
try {
|
286
|
+
const downloader = new Downloader();
|
167
287
|
const result = await downloader.youtubeDownloader(
|
168
288
|
'https://youtu.be/invalid-url'
|
169
289
|
);
|
@@ -173,24 +293,63 @@ try {
|
|
173
293
|
}
|
174
294
|
|
175
295
|
// Or using .catch()
|
296
|
+
const downloader = new Downloader();
|
176
297
|
downloader
|
177
|
-
.
|
298
|
+
.facebookDownloader('https://facebook.com/video/123')
|
178
299
|
.then(result => console.log(result))
|
179
300
|
.catch(error => console.error('Error:', error));
|
180
301
|
```
|
181
302
|
|
303
|
+
### Response Format
|
304
|
+
|
305
|
+
All API methods return a standardized response format:
|
306
|
+
|
307
|
+
```typescript
|
308
|
+
interface ApiResponse<T> {
|
309
|
+
creator: string; // Package creator information
|
310
|
+
status: number | boolean; // Success status (200 for success, false for error)
|
311
|
+
result?: T; // The actual data (varies by method)
|
312
|
+
msg?: string; // Error message if status indicates failure
|
313
|
+
}
|
314
|
+
```
|
315
|
+
|
316
|
+
Example responses:
|
317
|
+
|
318
|
+
```javascript
|
319
|
+
// Successful TikTok download
|
320
|
+
{
|
321
|
+
creator: "@abotscraper – ahmuq",
|
322
|
+
status: 200,
|
323
|
+
result: {
|
324
|
+
title: "Video Title",
|
325
|
+
video: "https://download-url.com/video.mp4",
|
326
|
+
audio: "https://download-url.com/audio.mp3"
|
327
|
+
}
|
328
|
+
}
|
329
|
+
|
330
|
+
// Error response
|
331
|
+
{
|
332
|
+
creator: "@abotscraper – ahmuq",
|
333
|
+
status: false,
|
334
|
+
msg: "Invalid URL provided"
|
335
|
+
}
|
336
|
+
```
|
337
|
+
|
182
338
|
## Requirements
|
183
339
|
|
184
340
|
- **Node.js**: Version 16.0.0 or higher
|
185
341
|
- **Internet connection**: Required for scraping online content
|
342
|
+
- **Dependencies**: All required dependencies are automatically installed
|
186
343
|
|
187
344
|
## Package Information
|
188
345
|
|
189
346
|
- **Package Type**: Dual (CommonJS + ES Modules)
|
190
|
-
- **Build
|
191
|
-
- **Source Format**: ES Modules
|
192
|
-
- **Distribution**: Both CommonJS and ESM builds included
|
193
|
-
- **TypeScript**: Full type declarations provided
|
347
|
+
- **Build System**: Modern TypeScript/JavaScript build pipeline
|
348
|
+
- **Source Format**: TypeScript with ES Modules
|
349
|
+
- **Distribution**: Both CommonJS (.cjs) and ESM (.mjs) builds included
|
350
|
+
- **TypeScript**: Full type declarations provided (.d.ts files)
|
351
|
+
- **Testing**: Comprehensive test suite with 100% coverage
|
352
|
+
- **Compatibility**: Works with Node.js, Bun, and other JavaScript runtimes
|
194
353
|
|
195
354
|
## Contributing
|
196
355
|
|
package/dist/index.cjs
CHANGED
@@ -172,7 +172,7 @@ var Downloader = class {
|
|
172
172
|
};
|
173
173
|
this.generator = new Generator();
|
174
174
|
}
|
175
|
-
async
|
175
|
+
async facebookDownloader(url) {
|
176
176
|
try {
|
177
177
|
const headers = {
|
178
178
|
"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",
|
@@ -251,72 +251,52 @@ var Downloader = class {
|
|
251
251
|
};
|
252
252
|
}
|
253
253
|
}
|
254
|
-
async
|
255
|
-
const payload = {
|
256
|
-
username
|
257
|
-
};
|
258
|
-
const headers = {
|
259
|
-
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/",
|
260
|
-
accept: "application/json, text/plain, */*",
|
261
|
-
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
262
|
-
"content-type": "application/json",
|
263
|
-
priority: "u=1, i",
|
264
|
-
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
265
|
-
"sec-ch-ua-mobile": "?0",
|
266
|
-
"sec-ch-ua-platform": '"Windows"',
|
267
|
-
"sec-fetch-dest": "empty",
|
268
|
-
"sec-fetch-mode": "cors",
|
269
|
-
"sec-fetch-site": "same-origin",
|
270
|
-
Referer: "https://storyviewer.com/",
|
271
|
-
"Referrer-Policy": "strict-origin-when-cross-origin"
|
272
|
-
};
|
254
|
+
async instagramDownloader(url) {
|
273
255
|
try {
|
256
|
+
const payload = new URLSearchParams({ url });
|
257
|
+
const headers = {
|
258
|
+
accept: "*/*",
|
259
|
+
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
260
|
+
"content-type": "application/x-www-form-urlencoded",
|
261
|
+
priority: "u=1, i",
|
262
|
+
"sec-ch-ua": '"Not)A;Brand";v="8", "Chromium";v="138", "Microsoft Edge";v="138"',
|
263
|
+
"sec-ch-ua-mobile": "?0",
|
264
|
+
"sec-ch-ua-platform": '"Windows"',
|
265
|
+
"sec-fetch-dest": "empty",
|
266
|
+
"sec-fetch-mode": "cors",
|
267
|
+
"sec-fetch-site": "same-origin"
|
268
|
+
};
|
274
269
|
const response = await import_axios.default.post(
|
275
|
-
|
270
|
+
"https://snapinsta.llc/process",
|
276
271
|
payload,
|
277
272
|
{ headers }
|
278
273
|
);
|
279
|
-
const
|
280
|
-
const
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
274
|
+
const $ = cheerio.load(response.data);
|
275
|
+
const downloadItems = [];
|
276
|
+
$(".download-item").each((_index, element) => {
|
277
|
+
const $element = $(element);
|
278
|
+
const previewImg = $element.find(".media-box img").attr("src");
|
279
|
+
const downloadLink = $element.find(".download-media").attr("href");
|
280
|
+
const downloadText = $element.find(".download-media").text().trim();
|
281
|
+
const isVideo = downloadText.toLowerCase().includes("video") || $element.find(".icon-downvid").length > 0;
|
282
|
+
if (downloadLink) {
|
283
|
+
const mediaItem = {
|
284
|
+
type: isVideo ? "video" : "image",
|
285
|
+
url: downloadLink
|
286
|
+
};
|
287
|
+
if (previewImg) {
|
288
|
+
mediaItem.preview = previewImg;
|
289
|
+
}
|
290
|
+
downloadItems.push(mediaItem);
|
287
291
|
}
|
288
|
-
};
|
289
|
-
} catch (error) {
|
290
|
-
return {
|
291
|
-
creator: global.creator,
|
292
|
-
status: false,
|
293
|
-
msg: error instanceof Error ? error.message : "Unknown error"
|
294
|
-
};
|
295
|
-
}
|
296
|
-
}
|
297
|
-
async instagram(url) {
|
298
|
-
try {
|
299
|
-
const config = new URLSearchParams({
|
300
|
-
url,
|
301
|
-
new: "2",
|
302
|
-
lang: "en",
|
303
|
-
app: ""
|
304
292
|
});
|
305
|
-
|
306
|
-
|
307
|
-
}
|
308
|
-
const response = await import_axios.default.post(
|
309
|
-
"https://snapinsta.app/get-data.php",
|
310
|
-
config,
|
311
|
-
{ headers }
|
312
|
-
);
|
313
|
-
const downloadLinks = response.data.files.map(
|
314
|
-
(file) => file.__type === "GraphVideo" ? { type: "video", url: file.video_url || "" } : file.__type === "GraphImage" ? { type: "image", url: file.download_url || "" } : null
|
315
|
-
).filter((link) => link !== null);
|
293
|
+
if (downloadItems.length === 0) {
|
294
|
+
throw new Error("No media items found in the response.");
|
295
|
+
}
|
316
296
|
return {
|
317
297
|
creator: global.creator,
|
318
298
|
status: 200,
|
319
|
-
result:
|
299
|
+
result: downloadItems
|
320
300
|
};
|
321
301
|
} catch (error) {
|
322
302
|
return {
|
@@ -327,60 +307,6 @@ var Downloader = class {
|
|
327
307
|
}
|
328
308
|
}
|
329
309
|
async youtubeDownloader(url) {
|
330
|
-
try {
|
331
|
-
const config = import_qs.default.stringify({
|
332
|
-
url,
|
333
|
-
q_auto: 0,
|
334
|
-
ajax: 1,
|
335
|
-
lang: "en"
|
336
|
-
});
|
337
|
-
const headers = {
|
338
|
-
"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"
|
339
|
-
};
|
340
|
-
const response = await import_axios.default.post(
|
341
|
-
"https://yt1s.net/ajax?retry=undefined&platform=youtube",
|
342
|
-
config,
|
343
|
-
{ headers }
|
344
|
-
);
|
345
|
-
const $ = cheerio.load(response.data.result);
|
346
|
-
const title = $(".caption b").text().trim();
|
347
|
-
const downloadLinks = {
|
348
|
-
"480p": $('a[data-fquality="480p"]').attr("href") || "",
|
349
|
-
"720p": $('a[data-fquality="720p"]').attr("href") || "",
|
350
|
-
"1080p": $('a[data-fquality="1080p"]').attr("href") || ""
|
351
|
-
};
|
352
|
-
const thumbnailUrl = $(".thumbnail.cover img").attr("src");
|
353
|
-
const mp3ConvertElement = $("#convert-mp3 a");
|
354
|
-
const hrefAttr = mp3ConvertElement.attr("href");
|
355
|
-
if (!hrefAttr) throw new Error("MP3 conversion link not found.");
|
356
|
-
const mp3ConvertTokenMatch = hrefAttr.match(
|
357
|
-
/mp3_convert_task\('(\d+)',\s*'([^']+)'\)/
|
358
|
-
);
|
359
|
-
if (!mp3ConvertTokenMatch)
|
360
|
-
throw new Error("MP3 conversion token not found.");
|
361
|
-
const mp3ConvertToken = mp3ConvertTokenMatch[2];
|
362
|
-
const mp3Response = await import_axios.default.get(
|
363
|
-
`https://api.fabdl.com/youtube/mp3-convert-task?token=${mp3ConvertToken}`
|
364
|
-
);
|
365
|
-
return {
|
366
|
-
creator: global.creator,
|
367
|
-
status: 200,
|
368
|
-
result: {
|
369
|
-
title,
|
370
|
-
thumbnail: thumbnailUrl || "",
|
371
|
-
downloadLinks,
|
372
|
-
mp3DownloadUrl: `https://api.fabdl.com${mp3Response.data.result.download_url}`
|
373
|
-
}
|
374
|
-
};
|
375
|
-
} catch (error) {
|
376
|
-
return {
|
377
|
-
creator: global.creator,
|
378
|
-
status: false,
|
379
|
-
msg: error instanceof Error ? error.message : "Unknown error"
|
380
|
-
};
|
381
|
-
}
|
382
|
-
}
|
383
|
-
async youtubeDownloaderV2(url) {
|
384
310
|
try {
|
385
311
|
const timestamp = this.generator.generateTimeStampYoutubeDL();
|
386
312
|
const footer = this.generator.generateFooterYoutubeDL(timestamp, url);
|
@@ -479,76 +405,6 @@ var cheerio2 = __toESM(require("cheerio"), 1);
|
|
479
405
|
global.creator = "@abotscraper \u2013 ahmuq";
|
480
406
|
var Search = class {
|
481
407
|
constructor() {
|
482
|
-
this.ytPlay = (text) => {
|
483
|
-
return new Promise((resolve, reject) => {
|
484
|
-
const configd = {
|
485
|
-
k_query: text,
|
486
|
-
k_page: "mp3",
|
487
|
-
q_auto: 1
|
488
|
-
};
|
489
|
-
const headerss = {
|
490
|
-
"sec-ch-ua": '" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
491
|
-
"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",
|
492
|
-
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}}'
|
493
|
-
};
|
494
|
-
(0, import_axios2.default)("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
495
|
-
method: "POST",
|
496
|
-
data: new URLSearchParams(Object.entries(configd)),
|
497
|
-
headers: headerss
|
498
|
-
}).then(({ data }) => {
|
499
|
-
const v = data.vitems;
|
500
|
-
const v2 = v[Math.floor(Math.random() * v.length)].v;
|
501
|
-
const url = "https://www.youtube.com/watch?v=" + v2;
|
502
|
-
const config = {
|
503
|
-
k_query: "https://www.youtube.be/" + url,
|
504
|
-
k_page: "mp3",
|
505
|
-
hl: "en",
|
506
|
-
q_auto: 1
|
507
|
-
};
|
508
|
-
(0, import_axios2.default)("https://www.y2mate.com/mates/en68/analyze/ajax", {
|
509
|
-
method: "POST",
|
510
|
-
data: new URLSearchParams({
|
511
|
-
url: "https://www.youtube.be/" + url,
|
512
|
-
q_auto: "0",
|
513
|
-
ajax: "1"
|
514
|
-
}),
|
515
|
-
headers: headerss
|
516
|
-
}).then(({ data: data2 }) => {
|
517
|
-
const $ = cheerio2.load(data2.result);
|
518
|
-
const img = $("div.thumbnail.cover > a > img").attr("src");
|
519
|
-
(0, import_axios2.default)("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
520
|
-
method: "POST",
|
521
|
-
data: new URLSearchParams(Object.entries(config)),
|
522
|
-
headers: headerss
|
523
|
-
}).then(({ data: data3 }) => {
|
524
|
-
const convertConfig = {
|
525
|
-
vid: data3.vid,
|
526
|
-
k: data3.links.mp3.mp3128.k
|
527
|
-
};
|
528
|
-
const size = data3.links.mp3.mp3128.size;
|
529
|
-
(0, import_axios2.default)("https://www.y2mate.com/mates/convertV2/index", {
|
530
|
-
method: "POST",
|
531
|
-
data: new URLSearchParams(Object.entries(convertConfig)),
|
532
|
-
headers: headerss
|
533
|
-
}).then((response) => {
|
534
|
-
resolve({
|
535
|
-
creator: global.creator,
|
536
|
-
status: 200,
|
537
|
-
result: {
|
538
|
-
status: response.data.status,
|
539
|
-
title: response.data.title,
|
540
|
-
ftype: response.data.ftype,
|
541
|
-
thumb: img || "",
|
542
|
-
size_mp3: size,
|
543
|
-
link: response.data.dlink
|
544
|
-
}
|
545
|
-
});
|
546
|
-
}).catch(reject);
|
547
|
-
});
|
548
|
-
});
|
549
|
-
}).catch(reject);
|
550
|
-
});
|
551
|
-
};
|
552
408
|
this.wallpaper = (title, page = "1") => {
|
553
409
|
return new Promise((resolve, reject) => {
|
554
410
|
import_axios2.default.get(
|
@@ -603,6 +459,49 @@ var Search = class {
|
|
603
459
|
});
|
604
460
|
};
|
605
461
|
}
|
462
|
+
async igStory(username) {
|
463
|
+
const payload = {
|
464
|
+
username
|
465
|
+
};
|
466
|
+
const headers = {
|
467
|
+
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/",
|
468
|
+
accept: "application/json, text/plain, */*",
|
469
|
+
"accept-language": "en-US,en;q=0.9,ar;q=0.8,id;q=0.7,vi;q=0.6",
|
470
|
+
"content-type": "application/json",
|
471
|
+
priority: "u=1, i",
|
472
|
+
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
473
|
+
"sec-ch-ua-mobile": "?0",
|
474
|
+
"sec-ch-ua-platform": '"Windows"',
|
475
|
+
"sec-fetch-dest": "empty",
|
476
|
+
"sec-fetch-mode": "cors",
|
477
|
+
"sec-fetch-site": "same-origin",
|
478
|
+
Referer: "https://storyviewer.com/",
|
479
|
+
"Referrer-Policy": "strict-origin-when-cross-origin"
|
480
|
+
};
|
481
|
+
try {
|
482
|
+
const response = await import_axios2.default.post(
|
483
|
+
`https://storyviewer.com/api/data`,
|
484
|
+
payload,
|
485
|
+
{ headers }
|
486
|
+
);
|
487
|
+
const data = response.data;
|
488
|
+
const sources = data.stories.map((story) => story.source);
|
489
|
+
return {
|
490
|
+
creator: global.creator,
|
491
|
+
status: 200,
|
492
|
+
result: {
|
493
|
+
user_info: data.user_info,
|
494
|
+
links: sources
|
495
|
+
}
|
496
|
+
};
|
497
|
+
} catch (error) {
|
498
|
+
return {
|
499
|
+
creator: global.creator,
|
500
|
+
status: false,
|
501
|
+
msg: error instanceof Error ? error.message : "Unknown error"
|
502
|
+
};
|
503
|
+
}
|
504
|
+
}
|
606
505
|
async sfileSearch(query, page = 1) {
|
607
506
|
try {
|
608
507
|
const response = await import_axios2.default.get(
|