abot-scraper 1.1.3 → 1.2.0

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,70 +1,215 @@
1
- # abot-scraper
2
-
3
- abot-scraper is a library node js. Can get data downloader like facebook, youtube, instagram and etc.
4
-
5
- # Installation
6
-
7
- Install stable version of scraper:
8
-
9
- ```sh
10
- npm i abot-scraper
11
- ```
12
-
13
- Install latest version from github (not recommended)
14
-
15
- ```sh
16
- npm i github:ahlulmukh/abot-scraper
17
- ```
18
-
19
- ## Usage
20
-
21
- For Downloader
22
-
23
- ```js
24
- const { downloader } = require("@ahlulmukh/abot-scraper");
25
-
26
- downloader
27
- .ytMP4("https://youtu.be/j_MlBCb9-m8?si=g6KsGM6cHNotU-rH")
28
- .then((result) => {
29
- console.log(result); // json;
30
- })
31
- .catch((error) => {
32
- console.error(error);
33
- });
34
- ```
35
-
36
- For Search
37
-
38
- ```js
39
- const { search } = require("@ahlulmukh/abot-scraper");
40
-
41
- search
42
- .ytPlay("Lagu Terbaru")
43
- .then((result) => {
44
- console.log(result); // json;
45
- })
46
- .catch((error) => {
47
- console.error(error);
48
- });
49
- ```
50
-
51
- ## Features
52
-
53
- - Youtube Downloader
54
- - Facebok Downloader
55
- - Tiktok Downloader
56
- - Instagram Downloader
57
- - Instastory Downloader
58
- - Pinterest Search
59
- - Youtube Play By query
60
- - Wallpaper
61
-
62
- ## Contributing
63
-
64
- If you find a bug or have a feature request, please open an issue on our GitHub repository.
65
-
66
- We welcome contributions from the community. If you'd like to contribute, please fork the repository and submit a pull request.
67
-
68
- ## License
69
-
70
- This project is licensed under the MIT License. See [LICENSE](LICENSE) for more details.
1
+ # abot-scraper
2
+
3
+ A versatile scraper package for downloading and searching content from various social media platforms.
4
+
5
+ ## Features
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
12
+
13
+ ## Installation
14
+
15
+ ### Stable Version
16
+
17
+ Install the latest stable version from npm:
18
+
19
+ ```bash
20
+ npm install abot-scraper
21
+ # or
22
+ yarn add abot-scraper
23
+ # or
24
+ bun add abot-scraper
25
+ ```
26
+
27
+ ### Development Version
28
+
29
+ Install the latest development version directly from GitHub (not recommended for production):
30
+
31
+ ```bash
32
+ npm install github:ahlulmukh/abot-scraper
33
+ ```
34
+
35
+ ## Usage
36
+
37
+ ### CommonJS (Node.js with require)
38
+
39
+ ```javascript
40
+ // Default import
41
+ const abot = require("abot-scraper");
42
+
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);
46
+
47
+ // Or import classes directly
48
+ const { Downloader, Search } = require("abot-scraper");
49
+ const downloader = new Downloader();
50
+ const search = new Search();
51
+ ```
52
+
53
+ ### ES Modules (modern JavaScript/TypeScript)
54
+
55
+ ```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);
62
+
63
+ // Or import classes directly
64
+ import { Downloader, Search } from "abot-scraper";
65
+ const downloader = new Downloader();
66
+ const search = new Search();
67
+ ```
68
+
69
+ ### TypeScript
70
+
71
+ TypeScript declarations are included, providing full type safety and IntelliSense support:
72
+
73
+ ```typescript
74
+ import abot, {
75
+ Downloader,
76
+ Search,
77
+ type ApiResponse,
78
+ type FacebookResult,
79
+ } from "abot-scraper";
80
+
81
+ // TypeScript will provide full type checking and autocomplete
82
+ const result: ApiResponse<FacebookResult> = await abot.downloader.facebook(
83
+ "https://facebook.com/video/123"
84
+ );
85
+
86
+ // Types are automatically inferred
87
+ const downloader = new Downloader();
88
+ const fbResult = await downloader.facebook("https://example.com"); // Return type is known
89
+ ```
90
+
91
+ ## API Reference
92
+
93
+ ### Downloader Class
94
+
95
+ The `Downloader` class provides methods to download content from various platforms.
96
+
97
+ #### Available Methods
98
+
99
+ - `facebook(url)` - Download Facebook videos
100
+ - `tiktokDownloader(url)` - Download TikTok videos
101
+ - `instagram(url)` - Download Instagram posts/stories
102
+ - `igstory(username)` - Get Instagram stories for a user
103
+ - `youtubeDownloader(url)` - Download YouTube videos with multiple formats
104
+ - `sfileDownloader(url)` - Download files from SFile
105
+
106
+ #### Example Usage
107
+
108
+ ```javascript
109
+ // CommonJS
110
+ const { downloader } = require("abot-scraper");
111
+
112
+ // ES Modules
113
+ import { downloader } from "abot-scraper";
114
+
115
+ // Download YouTube video
116
+ const result = await downloader.youtubeDownloader(
117
+ "https://youtu.be/j_MlBCb9-m8"
118
+ );
119
+ console.log(result);
120
+
121
+ // Download TikTok video
122
+ const tiktokResult = await downloader.tiktokDownloader(
123
+ "https://tiktok.com/@user/video/123"
124
+ );
125
+ console.log(tiktokResult);
126
+
127
+ // Download Facebook video
128
+ const fbResult = await downloader.facebook("https://facebook.com/video/123");
129
+ console.log(fbResult);
130
+
131
+ // Get Instagram stories
132
+ const storiesResult = await downloader.igstory("username");
133
+ console.log(storiesResult);
134
+ ```
135
+
136
+ ### Search Class
137
+
138
+ The `Search` class provides methods to search for content across various platforms.
139
+
140
+ #### Available Methods
141
+
142
+ - `ytPlay(query)` - Search YouTube videos by query
143
+ - `wallpaper(query, page)` - Search for wallpapers
144
+ - `wikimedia(query)` - Search Wikimedia content
145
+ - `sfileSearch(query, page)` - Search SFile for files
146
+
147
+ #### Example Usage
148
+
149
+ ```javascript
150
+ // CommonJS
151
+ const { search } = require("abot-scraper");
152
+
153
+ // ES Modules
154
+ import { search } from "abot-scraper";
155
+
156
+ // Search YouTube videos
157
+ const ytResults = await search.ytPlay("music video");
158
+ console.log(ytResults);
159
+
160
+ // Search wallpapers
161
+ const wallpapers = await search.wallpaper("abstract art", "1");
162
+ console.log(wallpapers);
163
+
164
+ // Search Wikimedia
165
+ const wikimediaResults = await search.wikimedia("nature photos");
166
+ console.log(wikimediaResults);
167
+ ```
168
+
169
+ ### Error Handling
170
+
171
+ All methods return promises and should be wrapped in try-catch blocks or use `.catch()` for proper error handling:
172
+
173
+ ```javascript
174
+ try {
175
+ const result = await downloader.youtubeDownloader(
176
+ "https://youtu.be/invalid-url"
177
+ );
178
+ console.log(result);
179
+ } catch (error) {
180
+ console.error("Download failed:", error.message);
181
+ }
182
+
183
+ // Or using .catch()
184
+ downloader
185
+ .facebook("https://facebook.com/video/123")
186
+ .then((result) => console.log(result))
187
+ .catch((error) => console.error("Error:", error));
188
+ ```
189
+
190
+ ## Requirements
191
+
192
+ - **Node.js**: Version 16.0.0 or higher
193
+ - **Internet connection**: Required for scraping online content
194
+
195
+ ## Package Information
196
+
197
+ - **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
202
+
203
+ ## Contributing
204
+
205
+ 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).
206
+
207
+ To contribute:
208
+
209
+ 1. Fork the repository.
210
+ 2. Create a new branch for your feature or bug fix.
211
+ 3. Submit a pull request with a detailed description of your changes.
212
+
213
+ ## License
214
+
215
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details.