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 CHANGED
@@ -1,6 +1,38 @@
1
1
  # abot-scraper
2
2
 
3
- A versatile scraper package for downloading and searching content from various social media platforms.
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,73 @@ npm install github:ahlulmukh/abot-scraper
26
58
 
27
59
  ## Usage
28
60
 
29
- ### CommonJS (Node.js with require)
61
+ ### Quick Start Example
30
62
 
31
63
  ```javascript
32
- // Default import
33
- const abot = require('abot-scraper');
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)
34
97
 
35
- // Use the pre-instantiated classes
36
- const result = await abot.downloader.facebook('https://facebook.com/video/123');
37
- const searchResult = await abot.search.sfileSearch('query', 1);
98
+ ```javascript
99
+ // Import classes directly
100
+ const { Downloader, Search, Tools } = require('abot-scraper');
38
101
 
39
- // Or import classes directly
40
- const { Downloader, Search } = require('abot-scraper');
41
102
  const downloader = new Downloader();
42
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);
43
111
  ```
44
112
 
45
113
  ### ES Modules (modern JavaScript/TypeScript)
46
114
 
47
115
  ```javascript
48
- // Default import
49
- import abot from 'abot-scraper';
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);
116
+ // Import classes directly
117
+ import { Downloader, Search, Tools } from 'abot-scraper';
54
118
 
55
- // Or import classes directly
56
- import { Downloader, Search } from 'abot-scraper';
57
119
  const downloader = new Downloader();
58
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);
59
128
  ```
60
129
 
61
130
  ### TypeScript
@@ -63,21 +132,22 @@ const search = new Search();
63
132
  TypeScript declarations are included, providing full type safety and IntelliSense support:
64
133
 
65
134
  ```typescript
66
- import abot, {
135
+ import {
67
136
  Downloader,
68
137
  Search,
138
+ Tools,
69
139
  type ApiResponse,
70
140
  type FacebookResult,
71
141
  } from 'abot-scraper';
72
142
 
73
143
  // TypeScript will provide full type checking and autocomplete
74
- const result: ApiResponse<FacebookResult> = await abot.downloader.facebook(
144
+ const downloader = new Downloader();
145
+ const result: ApiResponse<FacebookResult> = await downloader.facebookDownloader(
75
146
  'https://facebook.com/video/123'
76
147
  );
77
148
 
78
149
  // Types are automatically inferred
79
- const downloader = new Downloader();
80
- const fbResult = await downloader.facebook('https://example.com'); // Return type is known
150
+ const fbResult = await downloader.facebookDownloader('https://example.com'); // Return type is known
81
151
  ```
82
152
 
83
153
  ## API Reference
@@ -88,21 +158,19 @@ The `Downloader` class provides methods to download content from various platfor
88
158
 
89
159
  #### Available Methods
90
160
 
91
- - `facebook(url)` - Download Facebook videos
161
+ - `facebookDownloader(url)` - Download Facebook videos
92
162
  - `tiktokDownloader(url)` - Download TikTok videos
93
- - `instagram(url)` - Download Instagram posts/stories
94
- - `igstory(username)` - Get Instagram stories for a user
163
+ - `instagramDownloader(url)` - Download Instagram posts/stories/reels
95
164
  - `youtubeDownloader(url)` - Download YouTube videos with multiple formats
165
+ - `ytMp3Downloader(url)` - Download YouTube videos as MP3 audio
96
166
  - `sfileDownloader(url)` - Download files from SFile
97
167
 
98
168
  #### Example Usage
99
169
 
100
170
  ```javascript
101
- // CommonJS
102
- const { downloader } = require('abot-scraper');
103
-
104
- // ES Modules
105
- import { downloader } from 'abot-scraper';
171
+ // Import the Downloader class
172
+ const { Downloader } = require('abot-scraper');
173
+ const downloader = new Downloader();
106
174
 
107
175
  // Download YouTube video
108
176
  const result = await downloader.youtubeDownloader(
@@ -112,17 +180,27 @@ console.log(result);
112
180
 
113
181
  // Download TikTok video
114
182
  const tiktokResult = await downloader.tiktokDownloader(
115
- 'https://tiktok.com/@user/video/123'
183
+ 'https://vt.tiktok.com/ZSB2LtXQF/'
116
184
  );
117
185
  console.log(tiktokResult);
118
186
 
119
187
  // Download Facebook video
120
- const fbResult = await downloader.facebook('https://facebook.com/video/123');
188
+ const fbResult = await downloader.facebookDownloader(
189
+ 'https://facebook.com/video/123'
190
+ );
121
191
  console.log(fbResult);
122
192
 
123
- // Get Instagram stories
124
- const storiesResult = await downloader.igstory('username');
125
- console.log(storiesResult);
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);
126
204
  ```
127
205
 
128
206
  ### Search Class
@@ -131,31 +209,72 @@ The `Search` class provides methods to search for content across various platfor
131
209
 
132
210
  #### Available Methods
133
211
 
134
- - `ytPlay(query)` - Search YouTube videos by query
135
- - `wallpaper(query, page)` - Search for wallpapers
212
+ - `ytSearch(query)` - Search YouTube videos by query
213
+ - `igStory(username)` - Get Instagram stories for a user
214
+ - `wallpaper(query, page?)` - Search for wallpapers
136
215
  - `wikimedia(query)` - Search Wikimedia content
137
- - `sfileSearch(query, page)` - Search SFile for files
216
+ - `sfileSearch(query, page?)` - Search SFile for files
138
217
 
139
218
  #### Example Usage
140
219
 
141
220
  ```javascript
142
- // CommonJS
143
- const { search } = require('abot-scraper');
144
-
145
- // ES Modules
146
- import { search } from 'abot-scraper';
221
+ // Import the Search class
222
+ const { Search } = require('abot-scraper');
223
+ const search = new Search();
147
224
 
148
225
  // Search YouTube videos
149
- const ytResults = await search.ytPlay('music video');
226
+ const ytResults = await search.ytSearch('music video');
150
227
  console.log(ytResults);
151
228
 
229
+ // Get Instagram stories
230
+ const igStories = await search.igStory('cristiano');
231
+ console.log(igStories);
232
+
152
233
  // Search wallpapers
153
- const wallpapers = await search.wallpaper('abstract art', '1');
234
+ const wallpapers = await search.wallpaper('abstract art', 1);
154
235
  console.log(wallpapers);
155
236
 
156
237
  // Search Wikimedia
157
238
  const wikimediaResults = await search.wikimedia('nature photos');
158
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);
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
- .facebook('https://facebook.com/video/123')
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 Tool**: Bun.js
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