abot-scraper 1.7.0 → 1.7.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 +366 -366
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +79 -79
- package/dist/index.d.ts +79 -79
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +74 -74
- package/types/index.d.ts +188 -188
- /package/{LICENSE → license} +0 -0
package/README.MD
CHANGED
|
@@ -1,366 +1,366 @@
|
|
|
1
|
-
# abot-scraper
|
|
2
|
-
|
|
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
|
|
36
|
-
|
|
37
|
-
## Installation
|
|
38
|
-
|
|
39
|
-
### Stable Version
|
|
40
|
-
|
|
41
|
-
Install the latest stable version from npm:
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm install abot-scraper
|
|
45
|
-
# or
|
|
46
|
-
yarn add abot-scraper
|
|
47
|
-
# or
|
|
48
|
-
bun add abot-scraper
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
### Development Version
|
|
52
|
-
|
|
53
|
-
Install the latest development version directly from GitHub (not recommended for production):
|
|
54
|
-
|
|
55
|
-
```bash
|
|
56
|
-
npm install github:ahlulmukh/abot-scraper
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## Usage
|
|
60
|
-
|
|
61
|
-
### Quick Start Example
|
|
62
|
-
|
|
63
|
-
```javascript
|
|
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 imageBuffer = fs.readFileSync('path/to/image.jpg');
|
|
86
|
-
const bgRemoved = await tools.removeBackground(imageBuffer);
|
|
87
|
-
console.log('Background removed:', bgRemoved);
|
|
88
|
-
} catch (error) {
|
|
89
|
-
console.error('Error:', error.message);
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
example();
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
### CommonJS (Node.js with require)
|
|
97
|
-
|
|
98
|
-
```javascript
|
|
99
|
-
// Import classes directly
|
|
100
|
-
const { Downloader, Search, Tools } = require('abot-scraper');
|
|
101
|
-
|
|
102
|
-
const downloader = new Downloader();
|
|
103
|
-
const search = new Search();
|
|
104
|
-
const tools = new Tools();
|
|
105
|
-
|
|
106
|
-
// Download a Facebook video
|
|
107
|
-
const result = await downloader.facebookDownloader(
|
|
108
|
-
'https://facebook.com/video/123'
|
|
109
|
-
);
|
|
110
|
-
const searchResult = await search.sfileSearch('query', 1);
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### ES Modules (modern JavaScript/TypeScript)
|
|
114
|
-
|
|
115
|
-
```javascript
|
|
116
|
-
// Import classes directly
|
|
117
|
-
import { Downloader, Search, Tools } from 'abot-scraper';
|
|
118
|
-
|
|
119
|
-
const downloader = new Downloader();
|
|
120
|
-
const search = new Search();
|
|
121
|
-
const tools = new Tools();
|
|
122
|
-
|
|
123
|
-
// Download a Facebook video
|
|
124
|
-
const result = await downloader.facebookDownloader(
|
|
125
|
-
'https://facebook.com/video/123'
|
|
126
|
-
);
|
|
127
|
-
const searchResult = await search.sfileSearch('query', 1);
|
|
128
|
-
```
|
|
129
|
-
|
|
130
|
-
### TypeScript
|
|
131
|
-
|
|
132
|
-
TypeScript declarations are included, providing full type safety and IntelliSense support:
|
|
133
|
-
|
|
134
|
-
```typescript
|
|
135
|
-
import {
|
|
136
|
-
Downloader,
|
|
137
|
-
Search,
|
|
138
|
-
Tools,
|
|
139
|
-
type ApiResponse,
|
|
140
|
-
type FacebookResult,
|
|
141
|
-
} from 'abot-scraper';
|
|
142
|
-
|
|
143
|
-
// TypeScript will provide full type checking and autocomplete
|
|
144
|
-
const downloader = new Downloader();
|
|
145
|
-
const result: ApiResponse<FacebookResult> = await downloader.facebookDownloader(
|
|
146
|
-
'https://facebook.com/video/123'
|
|
147
|
-
);
|
|
148
|
-
|
|
149
|
-
// Types are automatically inferred
|
|
150
|
-
const fbResult = await downloader.facebookDownloader('https://example.com'); // Return type is known
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
## API Reference
|
|
154
|
-
|
|
155
|
-
### Downloader Class
|
|
156
|
-
|
|
157
|
-
The `Downloader` class provides methods to download content from various platforms.
|
|
158
|
-
|
|
159
|
-
#### Available Methods
|
|
160
|
-
|
|
161
|
-
- `facebookDownloader(url)` - Download Facebook videos
|
|
162
|
-
- `tiktokDownloader(url)` - Download TikTok videos
|
|
163
|
-
- `instagramDownloader(url)` - Download Instagram posts/stories/reels
|
|
164
|
-
- `youtubeDownloader(url)` - Download YouTube videos with multiple formats
|
|
165
|
-
- `ytMp3Downloader(url)` - Download YouTube videos as MP3 audio
|
|
166
|
-
- `sfileDownloader(url)` - Download files from SFile
|
|
167
|
-
|
|
168
|
-
#### Example Usage
|
|
169
|
-
|
|
170
|
-
```javascript
|
|
171
|
-
// Import the Downloader class
|
|
172
|
-
const { Downloader } = require('abot-scraper');
|
|
173
|
-
const downloader = new Downloader();
|
|
174
|
-
|
|
175
|
-
// Download YouTube video
|
|
176
|
-
const result = await downloader.youtubeDownloader(
|
|
177
|
-
'https://youtu.be/j_MlBCb9-m8'
|
|
178
|
-
);
|
|
179
|
-
console.log(result);
|
|
180
|
-
|
|
181
|
-
// Download TikTok video
|
|
182
|
-
const tiktokResult = await downloader.tiktokDownloader(
|
|
183
|
-
'https://vt.tiktok.com/ZSB2LtXQF/'
|
|
184
|
-
);
|
|
185
|
-
console.log(tiktokResult);
|
|
186
|
-
|
|
187
|
-
// Download Facebook video
|
|
188
|
-
const fbResult = await downloader.facebookDownloader(
|
|
189
|
-
'https://facebook.com/video/123'
|
|
190
|
-
);
|
|
191
|
-
console.log(fbResult);
|
|
192
|
-
|
|
193
|
-
// Download Instagram content
|
|
194
|
-
const igResult = await downloader.instagramDownloader(
|
|
195
|
-
'https://www.instagram.com/p/CK0tLXyAzEI/'
|
|
196
|
-
);
|
|
197
|
-
console.log(igResult);
|
|
198
|
-
|
|
199
|
-
// Download YouTube as MP3
|
|
200
|
-
const mp3Result = await downloader.ytMp3Downloader(
|
|
201
|
-
'https://youtu.be/H_z0t5NQs7U'
|
|
202
|
-
);
|
|
203
|
-
console.log(mp3Result);
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
### Search Class
|
|
207
|
-
|
|
208
|
-
The `Search` class provides methods to search for content across various platforms.
|
|
209
|
-
|
|
210
|
-
#### Available Methods
|
|
211
|
-
|
|
212
|
-
- `ytSearch(query)` - Search YouTube videos by query
|
|
213
|
-
- `igStory(username)` - Get Instagram stories for a user
|
|
214
|
-
- `wallpaper(query, page?)` - Search for wallpapers
|
|
215
|
-
- `wikimedia(query)` - Search Wikimedia content
|
|
216
|
-
- `sfileSearch(query, page?)` - Search SFile for files
|
|
217
|
-
|
|
218
|
-
#### Example Usage
|
|
219
|
-
|
|
220
|
-
```javascript
|
|
221
|
-
// Import the Search class
|
|
222
|
-
const { Search } = require('abot-scraper');
|
|
223
|
-
const search = new Search();
|
|
224
|
-
|
|
225
|
-
// Search YouTube videos
|
|
226
|
-
const ytResults = await search.ytSearch('music video');
|
|
227
|
-
console.log(ytResults);
|
|
228
|
-
|
|
229
|
-
// Get Instagram stories
|
|
230
|
-
const igStories = await search.igStory('cristiano');
|
|
231
|
-
console.log(igStories);
|
|
232
|
-
|
|
233
|
-
// Search wallpapers
|
|
234
|
-
const wallpapers = await search.wallpaper('abstract art', 1);
|
|
235
|
-
console.log(wallpapers);
|
|
236
|
-
|
|
237
|
-
// Search Wikimedia
|
|
238
|
-
const wikimediaResults = await search.wikimedia('nature photos');
|
|
239
|
-
console.log(wikimediaResults);
|
|
240
|
-
|
|
241
|
-
// Search SFile
|
|
242
|
-
const sfileResults = await search.sfileSearch('Capcut Pro');
|
|
243
|
-
console.log(sfileResults);
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### Tools Class
|
|
247
|
-
|
|
248
|
-
The `Tools` class provides utility methods for image processing and manipulation.
|
|
249
|
-
|
|
250
|
-
#### Available Methods
|
|
251
|
-
|
|
252
|
-
- `removeBackground(buffer)` - Remove background from an image using AI
|
|
253
|
-
- `reminiV1(buffer)` - Enhance image quality using Remini V1 API
|
|
254
|
-
- `reminiV2(buffer)` - Enhance image quality using Remini V2 API
|
|
255
|
-
- `uploadImage(buffer)` - Upload image and get a shareable URL
|
|
256
|
-
|
|
257
|
-
#### Example Usage
|
|
258
|
-
|
|
259
|
-
```javascript
|
|
260
|
-
// Import the Tools class
|
|
261
|
-
const { Tools } = require('abot-scraper');
|
|
262
|
-
const fs = require('fs');
|
|
263
|
-
const tools = new Tools();
|
|
264
|
-
|
|
265
|
-
// Remove background from image
|
|
266
|
-
const imageBuffer = fs.readFileSync('path/to/image.jpg');
|
|
267
|
-
const bgRemoved = await tools.removeBackground(imageBuffer);
|
|
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);
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
### Error Handling
|
|
281
|
-
|
|
282
|
-
All methods return promises and should be wrapped in try-catch blocks or use `.catch()` for proper error handling:
|
|
283
|
-
|
|
284
|
-
```javascript
|
|
285
|
-
try {
|
|
286
|
-
const downloader = new Downloader();
|
|
287
|
-
const result = await downloader.youtubeDownloader(
|
|
288
|
-
'https://youtu.be/invalid-url'
|
|
289
|
-
);
|
|
290
|
-
console.log(result);
|
|
291
|
-
} catch (error) {
|
|
292
|
-
console.error('Download failed:', error.message);
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Or using .catch()
|
|
296
|
-
const downloader = new Downloader();
|
|
297
|
-
downloader
|
|
298
|
-
.facebookDownloader('https://facebook.com/video/123')
|
|
299
|
-
.then(result => console.log(result))
|
|
300
|
-
.catch(error => console.error('Error:', error));
|
|
301
|
-
```
|
|
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
|
-
|
|
338
|
-
## Requirements
|
|
339
|
-
|
|
340
|
-
- **Node.js**: Version 16.0.0 or higher
|
|
341
|
-
- **Internet connection**: Required for scraping online content
|
|
342
|
-
- **Dependencies**: All required dependencies are automatically installed
|
|
343
|
-
|
|
344
|
-
## Package Information
|
|
345
|
-
|
|
346
|
-
- **Package Type**: Dual (CommonJS + ES Modules)
|
|
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
|
|
353
|
-
|
|
354
|
-
## Contributing
|
|
355
|
-
|
|
356
|
-
We welcome contributions from the community! If you encounter a bug or have a feature request, please open an issue on our [GitHub repository](https://github.com/ahlulmukh/abot-scraper).
|
|
357
|
-
|
|
358
|
-
To contribute:
|
|
359
|
-
|
|
360
|
-
1. Fork the repository.
|
|
361
|
-
2. Create a new branch for your feature or bug fix.
|
|
362
|
-
3. Submit a pull request with a detailed description of your changes.
|
|
363
|
-
|
|
364
|
-
## License
|
|
365
|
-
|
|
366
|
-
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|
|
1
|
+
# abot-scraper
|
|
2
|
+
|
|
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
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
### Stable Version
|
|
40
|
+
|
|
41
|
+
Install the latest stable version from npm:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npm install abot-scraper
|
|
45
|
+
# or
|
|
46
|
+
yarn add abot-scraper
|
|
47
|
+
# or
|
|
48
|
+
bun add abot-scraper
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Development Version
|
|
52
|
+
|
|
53
|
+
Install the latest development version directly from GitHub (not recommended for production):
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
npm install github:ahlulmukh/abot-scraper
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
### Quick Start Example
|
|
62
|
+
|
|
63
|
+
```javascript
|
|
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 imageBuffer = fs.readFileSync('path/to/image.jpg');
|
|
86
|
+
const bgRemoved = await tools.removeBackground(imageBuffer);
|
|
87
|
+
console.log('Background removed:', bgRemoved);
|
|
88
|
+
} catch (error) {
|
|
89
|
+
console.error('Error:', error.message);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
example();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### CommonJS (Node.js with require)
|
|
97
|
+
|
|
98
|
+
```javascript
|
|
99
|
+
// Import classes directly
|
|
100
|
+
const { Downloader, Search, Tools } = require('abot-scraper');
|
|
101
|
+
|
|
102
|
+
const downloader = new Downloader();
|
|
103
|
+
const search = new Search();
|
|
104
|
+
const tools = new Tools();
|
|
105
|
+
|
|
106
|
+
// Download a Facebook video
|
|
107
|
+
const result = await downloader.facebookDownloader(
|
|
108
|
+
'https://facebook.com/video/123'
|
|
109
|
+
);
|
|
110
|
+
const searchResult = await search.sfileSearch('query', 1);
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### ES Modules (modern JavaScript/TypeScript)
|
|
114
|
+
|
|
115
|
+
```javascript
|
|
116
|
+
// Import classes directly
|
|
117
|
+
import { Downloader, Search, Tools } from 'abot-scraper';
|
|
118
|
+
|
|
119
|
+
const downloader = new Downloader();
|
|
120
|
+
const search = new Search();
|
|
121
|
+
const tools = new Tools();
|
|
122
|
+
|
|
123
|
+
// Download a Facebook video
|
|
124
|
+
const result = await downloader.facebookDownloader(
|
|
125
|
+
'https://facebook.com/video/123'
|
|
126
|
+
);
|
|
127
|
+
const searchResult = await search.sfileSearch('query', 1);
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
### TypeScript
|
|
131
|
+
|
|
132
|
+
TypeScript declarations are included, providing full type safety and IntelliSense support:
|
|
133
|
+
|
|
134
|
+
```typescript
|
|
135
|
+
import {
|
|
136
|
+
Downloader,
|
|
137
|
+
Search,
|
|
138
|
+
Tools,
|
|
139
|
+
type ApiResponse,
|
|
140
|
+
type FacebookResult,
|
|
141
|
+
} from 'abot-scraper';
|
|
142
|
+
|
|
143
|
+
// TypeScript will provide full type checking and autocomplete
|
|
144
|
+
const downloader = new Downloader();
|
|
145
|
+
const result: ApiResponse<FacebookResult> = await downloader.facebookDownloader(
|
|
146
|
+
'https://facebook.com/video/123'
|
|
147
|
+
);
|
|
148
|
+
|
|
149
|
+
// Types are automatically inferred
|
|
150
|
+
const fbResult = await downloader.facebookDownloader('https://example.com'); // Return type is known
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## API Reference
|
|
154
|
+
|
|
155
|
+
### Downloader Class
|
|
156
|
+
|
|
157
|
+
The `Downloader` class provides methods to download content from various platforms.
|
|
158
|
+
|
|
159
|
+
#### Available Methods
|
|
160
|
+
|
|
161
|
+
- `facebookDownloader(url)` - Download Facebook videos
|
|
162
|
+
- `tiktokDownloader(url)` - Download TikTok videos
|
|
163
|
+
- `instagramDownloader(url)` - Download Instagram posts/stories/reels
|
|
164
|
+
- `youtubeDownloader(url)` - Download YouTube videos with multiple formats
|
|
165
|
+
- `ytMp3Downloader(url)` - Download YouTube videos as MP3 audio
|
|
166
|
+
- `sfileDownloader(url)` - Download files from SFile
|
|
167
|
+
|
|
168
|
+
#### Example Usage
|
|
169
|
+
|
|
170
|
+
```javascript
|
|
171
|
+
// Import the Downloader class
|
|
172
|
+
const { Downloader } = require('abot-scraper');
|
|
173
|
+
const downloader = new Downloader();
|
|
174
|
+
|
|
175
|
+
// Download YouTube video
|
|
176
|
+
const result = await downloader.youtubeDownloader(
|
|
177
|
+
'https://youtu.be/j_MlBCb9-m8'
|
|
178
|
+
);
|
|
179
|
+
console.log(result);
|
|
180
|
+
|
|
181
|
+
// Download TikTok video
|
|
182
|
+
const tiktokResult = await downloader.tiktokDownloader(
|
|
183
|
+
'https://vt.tiktok.com/ZSB2LtXQF/'
|
|
184
|
+
);
|
|
185
|
+
console.log(tiktokResult);
|
|
186
|
+
|
|
187
|
+
// Download Facebook video
|
|
188
|
+
const fbResult = await downloader.facebookDownloader(
|
|
189
|
+
'https://facebook.com/video/123'
|
|
190
|
+
);
|
|
191
|
+
console.log(fbResult);
|
|
192
|
+
|
|
193
|
+
// Download Instagram content
|
|
194
|
+
const igResult = await downloader.instagramDownloader(
|
|
195
|
+
'https://www.instagram.com/p/CK0tLXyAzEI/'
|
|
196
|
+
);
|
|
197
|
+
console.log(igResult);
|
|
198
|
+
|
|
199
|
+
// Download YouTube as MP3
|
|
200
|
+
const mp3Result = await downloader.ytMp3Downloader(
|
|
201
|
+
'https://youtu.be/H_z0t5NQs7U'
|
|
202
|
+
);
|
|
203
|
+
console.log(mp3Result);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Search Class
|
|
207
|
+
|
|
208
|
+
The `Search` class provides methods to search for content across various platforms.
|
|
209
|
+
|
|
210
|
+
#### Available Methods
|
|
211
|
+
|
|
212
|
+
- `ytSearch(query)` - Search YouTube videos by query
|
|
213
|
+
- `igStory(username)` - Get Instagram stories for a user
|
|
214
|
+
- `wallpaper(query, page?)` - Search for wallpapers
|
|
215
|
+
- `wikimedia(query)` - Search Wikimedia content
|
|
216
|
+
- `sfileSearch(query, page?)` - Search SFile for files
|
|
217
|
+
|
|
218
|
+
#### Example Usage
|
|
219
|
+
|
|
220
|
+
```javascript
|
|
221
|
+
// Import the Search class
|
|
222
|
+
const { Search } = require('abot-scraper');
|
|
223
|
+
const search = new Search();
|
|
224
|
+
|
|
225
|
+
// Search YouTube videos
|
|
226
|
+
const ytResults = await search.ytSearch('music video');
|
|
227
|
+
console.log(ytResults);
|
|
228
|
+
|
|
229
|
+
// Get Instagram stories
|
|
230
|
+
const igStories = await search.igStory('cristiano');
|
|
231
|
+
console.log(igStories);
|
|
232
|
+
|
|
233
|
+
// Search wallpapers
|
|
234
|
+
const wallpapers = await search.wallpaper('abstract art', 1);
|
|
235
|
+
console.log(wallpapers);
|
|
236
|
+
|
|
237
|
+
// Search Wikimedia
|
|
238
|
+
const wikimediaResults = await search.wikimedia('nature photos');
|
|
239
|
+
console.log(wikimediaResults);
|
|
240
|
+
|
|
241
|
+
// Search SFile
|
|
242
|
+
const sfileResults = await search.sfileSearch('Capcut Pro');
|
|
243
|
+
console.log(sfileResults);
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Tools Class
|
|
247
|
+
|
|
248
|
+
The `Tools` class provides utility methods for image processing and manipulation.
|
|
249
|
+
|
|
250
|
+
#### Available Methods
|
|
251
|
+
|
|
252
|
+
- `removeBackground(buffer)` - Remove background from an image using AI
|
|
253
|
+
- `reminiV1(buffer)` - Enhance image quality using Remini V1 API
|
|
254
|
+
- `reminiV2(buffer)` - Enhance image quality using Remini V2 API
|
|
255
|
+
- `uploadImage(buffer)` - Upload image and get a shareable URL
|
|
256
|
+
|
|
257
|
+
#### Example Usage
|
|
258
|
+
|
|
259
|
+
```javascript
|
|
260
|
+
// Import the Tools class
|
|
261
|
+
const { Tools } = require('abot-scraper');
|
|
262
|
+
const fs = require('fs');
|
|
263
|
+
const tools = new Tools();
|
|
264
|
+
|
|
265
|
+
// Remove background from image
|
|
266
|
+
const imageBuffer = fs.readFileSync('path/to/image.jpg');
|
|
267
|
+
const bgRemoved = await tools.removeBackground(imageBuffer);
|
|
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);
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Error Handling
|
|
281
|
+
|
|
282
|
+
All methods return promises and should be wrapped in try-catch blocks or use `.catch()` for proper error handling:
|
|
283
|
+
|
|
284
|
+
```javascript
|
|
285
|
+
try {
|
|
286
|
+
const downloader = new Downloader();
|
|
287
|
+
const result = await downloader.youtubeDownloader(
|
|
288
|
+
'https://youtu.be/invalid-url'
|
|
289
|
+
);
|
|
290
|
+
console.log(result);
|
|
291
|
+
} catch (error) {
|
|
292
|
+
console.error('Download failed:', error.message);
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
// Or using .catch()
|
|
296
|
+
const downloader = new Downloader();
|
|
297
|
+
downloader
|
|
298
|
+
.facebookDownloader('https://facebook.com/video/123')
|
|
299
|
+
.then(result => console.log(result))
|
|
300
|
+
.catch(error => console.error('Error:', error));
|
|
301
|
+
```
|
|
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
|
+
|
|
338
|
+
## Requirements
|
|
339
|
+
|
|
340
|
+
- **Node.js**: Version 16.0.0 or higher
|
|
341
|
+
- **Internet connection**: Required for scraping online content
|
|
342
|
+
- **Dependencies**: All required dependencies are automatically installed
|
|
343
|
+
|
|
344
|
+
## Package Information
|
|
345
|
+
|
|
346
|
+
- **Package Type**: Dual (CommonJS + ES Modules)
|
|
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
|
|
353
|
+
|
|
354
|
+
## Contributing
|
|
355
|
+
|
|
356
|
+
We welcome contributions from the community! If you encounter a bug or have a feature request, please open an issue on our [GitHub repository](https://github.com/ahlulmukh/abot-scraper).
|
|
357
|
+
|
|
358
|
+
To contribute:
|
|
359
|
+
|
|
360
|
+
1. Fork the repository.
|
|
361
|
+
2. Create a new branch for your feature or bug fix.
|
|
362
|
+
3. Submit a pull request with a detailed description of your changes.
|
|
363
|
+
|
|
364
|
+
## License
|
|
365
|
+
|
|
366
|
+
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.
|