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 +215 -70
- package/dist/index.cjs +575 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +123 -0
- package/dist/index.d.ts +123 -0
- package/dist/index.js +535 -0
- package/dist/index.js.map +1 -0
- package/package.json +66 -24
- package/types/index.d.ts +172 -0
- package/src/index.js +0 -7
- package/src/scraper/downloader.js +0 -215
- package/src/scraper/search.js +0 -144
- package/testing.js +0 -90
package/README.MD
CHANGED
@@ -1,70 +1,215 @@
|
|
1
|
-
# abot-scraper
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
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.
|