abot-scraper 1.5.1 → 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 CHANGED
@@ -1,14 +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
4
 
5
5
  ## Features
6
6
 
7
- - **Dual Package Support**: Works with both CommonJS (`require`) and ES Modules (`import`)
8
- - 🚀 **Built with Bun**: Optimized build process using Bun.js
9
- - 📱 **Multi-platform**: Supports Facebook, Instagram, TikTok, YouTube, and SFile
10
- - 🔍 **Search functionality**: Search content across supported platforms
11
- - 📝 **TypeScript Support**: Full TypeScript declarations included
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
12
36
 
13
37
  ## Installation
14
38
 
@@ -34,36 +58,74 @@ npm install github:ahlulmukh/abot-scraper
34
58
 
35
59
  ## Usage
36
60
 
37
- ### CommonJS (Node.js with require)
61
+ ### Quick Start Example
38
62
 
39
63
  ```javascript
40
- // Default import
41
- 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 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
+ ```
42
96
 
43
- // Use the pre-instantiated classes
44
- const result = await abot.downloader.facebook("https://facebook.com/video/123");
45
- const searchResult = await abot.search.sfileSearch("query", 1);
97
+ ### CommonJS (Node.js with require)
98
+
99
+ ```javascript
100
+ // Import classes directly
101
+ const { Downloader, Search, Tools } = require('abot-scraper');
46
102
 
47
- // Or import classes directly
48
- const { Downloader, Search } = require("abot-scraper");
49
103
  const downloader = new Downloader();
50
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);
51
112
  ```
52
113
 
53
114
  ### ES Modules (modern JavaScript/TypeScript)
54
115
 
55
116
  ```javascript
56
- // Default import
57
- import abot from "abot-scraper";
58
-
59
- // Use the pre-instantiated classes
60
- const result = await abot.downloader.facebook("https://facebook.com/video/123");
61
- const searchResult = await abot.search.sfileSearch("query", 1);
117
+ // Import classes directly
118
+ import { Downloader, Search, Tools } from 'abot-scraper';
62
119
 
63
- // Or import classes directly
64
- import { Downloader, Search } from "abot-scraper";
65
120
  const downloader = new Downloader();
66
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);
67
129
  ```
68
130
 
69
131
  ### TypeScript
@@ -71,21 +133,22 @@ const search = new Search();
71
133
  TypeScript declarations are included, providing full type safety and IntelliSense support:
72
134
 
73
135
  ```typescript
74
- import abot, {
136
+ import {
75
137
  Downloader,
76
138
  Search,
139
+ Tools,
77
140
  type ApiResponse,
78
141
  type FacebookResult,
79
- } from "abot-scraper";
142
+ } from 'abot-scraper';
80
143
 
81
144
  // TypeScript will provide full type checking and autocomplete
82
- const result: ApiResponse<FacebookResult> = await abot.downloader.facebook(
83
- "https://facebook.com/video/123"
145
+ const downloader = new Downloader();
146
+ const result: ApiResponse<FacebookResult> = await downloader.facebookDownloader(
147
+ 'https://facebook.com/video/123'
84
148
  );
85
149
 
86
150
  // Types are automatically inferred
87
- const downloader = new Downloader();
88
- 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
89
152
  ```
90
153
 
91
154
  ## API Reference
@@ -96,41 +159,49 @@ The `Downloader` class provides methods to download content from various platfor
96
159
 
97
160
  #### Available Methods
98
161
 
99
- - `facebook(url)` - Download Facebook videos
162
+ - `facebookDownloader(url)` - Download Facebook videos
100
163
  - `tiktokDownloader(url)` - Download TikTok videos
101
- - `instagram(url)` - Download Instagram posts/stories
102
- - `igstory(username)` - Get Instagram stories for a user
164
+ - `instagramDownloader(url)` - Download Instagram posts/stories/reels
103
165
  - `youtubeDownloader(url)` - Download YouTube videos with multiple formats
166
+ - `ytMp3Downloader(url)` - Download YouTube videos as MP3 audio
104
167
  - `sfileDownloader(url)` - Download files from SFile
105
168
 
106
169
  #### Example Usage
107
170
 
108
171
  ```javascript
109
- // CommonJS
110
- const { downloader } = require("abot-scraper");
111
-
112
- // ES Modules
113
- import { downloader } from "abot-scraper";
172
+ // Import the Downloader class
173
+ const { Downloader } = require('abot-scraper');
174
+ const downloader = new Downloader();
114
175
 
115
176
  // Download YouTube video
116
177
  const result = await downloader.youtubeDownloader(
117
- "https://youtu.be/j_MlBCb9-m8"
178
+ 'https://youtu.be/j_MlBCb9-m8'
118
179
  );
119
180
  console.log(result);
120
181
 
121
182
  // Download TikTok video
122
183
  const tiktokResult = await downloader.tiktokDownloader(
123
- "https://tiktok.com/@user/video/123"
184
+ 'https://vt.tiktok.com/ZSB2LtXQF/'
124
185
  );
125
186
  console.log(tiktokResult);
126
187
 
127
188
  // Download Facebook video
128
- const fbResult = await downloader.facebook("https://facebook.com/video/123");
189
+ const fbResult = await downloader.facebookDownloader(
190
+ 'https://facebook.com/video/123'
191
+ );
129
192
  console.log(fbResult);
130
193
 
131
- // Get Instagram stories
132
- const storiesResult = await downloader.igstory("username");
133
- console.log(storiesResult);
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);
134
205
  ```
135
206
 
136
207
  ### Search Class
@@ -139,31 +210,71 @@ The `Search` class provides methods to search for content across various platfor
139
210
 
140
211
  #### Available Methods
141
212
 
142
- - `ytPlay(query)` - Search YouTube videos by query
143
- - `wallpaper(query, page)` - Search for wallpapers
213
+ - `ytSearch(query)` - Search YouTube videos by query
214
+ - `igStory(username)` - Get Instagram stories for a user
215
+ - `wallpaper(query, page?)` - Search for wallpapers
144
216
  - `wikimedia(query)` - Search Wikimedia content
145
- - `sfileSearch(query, page)` - Search SFile for files
217
+ - `sfileSearch(query, page?)` - Search SFile for files
146
218
 
147
219
  #### Example Usage
148
220
 
149
221
  ```javascript
150
- // CommonJS
151
- const { search } = require("abot-scraper");
152
-
153
- // ES Modules
154
- import { search } from "abot-scraper";
222
+ // Import the Search class
223
+ const { Search } = require('abot-scraper');
224
+ const search = new Search();
155
225
 
156
226
  // Search YouTube videos
157
- const ytResults = await search.ytPlay("music video");
227
+ const ytResults = await search.ytSearch('music video');
158
228
  console.log(ytResults);
159
229
 
230
+ // Get Instagram stories
231
+ const igStories = await search.igStory('cristiano');
232
+ console.log(igStories);
233
+
160
234
  // Search wallpapers
161
- const wallpapers = await search.wallpaper("abstract art", "1");
235
+ const wallpapers = await search.wallpaper('abstract art', 1);
162
236
  console.log(wallpapers);
163
237
 
164
238
  // Search Wikimedia
165
- const wikimediaResults = await search.wikimedia("nature photos");
239
+ const wikimediaResults = await search.wikimedia('nature photos');
166
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);
167
278
  ```
168
279
 
169
280
  ### Error Handling
@@ -172,33 +283,73 @@ All methods return promises and should be wrapped in try-catch blocks or use `.c
172
283
 
173
284
  ```javascript
174
285
  try {
286
+ const downloader = new Downloader();
175
287
  const result = await downloader.youtubeDownloader(
176
- "https://youtu.be/invalid-url"
288
+ 'https://youtu.be/invalid-url'
177
289
  );
178
290
  console.log(result);
179
291
  } catch (error) {
180
- console.error("Download failed:", error.message);
292
+ console.error('Download failed:', error.message);
181
293
  }
182
294
 
183
295
  // Or using .catch()
296
+ const downloader = new Downloader();
184
297
  downloader
185
- .facebook("https://facebook.com/video/123")
186
- .then((result) => console.log(result))
187
- .catch((error) => console.error("Error:", error));
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
+ }
188
336
  ```
189
337
 
190
338
  ## Requirements
191
339
 
192
340
  - **Node.js**: Version 16.0.0 or higher
193
341
  - **Internet connection**: Required for scraping online content
342
+ - **Dependencies**: All required dependencies are automatically installed
194
343
 
195
344
  ## Package Information
196
345
 
197
346
  - **Package Type**: Dual (CommonJS + ES Modules)
198
- - **Build Tool**: Bun.js
199
- - **Source Format**: ES Modules
200
- - **Distribution**: Both CommonJS and ESM builds included
201
- - **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
202
353
 
203
354
  ## Contributing
204
355