abot-scraper 1.0.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 +46 -0
- package/package.json +18 -0
- package/src/index.js +15 -0
- package/src/scraper/downloader.js +275 -0
package/README.MD
ADDED
@@ -0,0 +1,46 @@
|
|
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 @ahlulmukh/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
|
+
```js
|
22
|
+
const { ytMP4 } = require("@ahlulmukh/abot-scraper)
|
23
|
+
ytMP4("https://youtu.be/j_MlBCb9-m8?si=g6KsGM6cHNotU-rH")
|
24
|
+
.then((result) => {
|
25
|
+
console.log(result); // json;
|
26
|
+
})
|
27
|
+
.catch((error) => {
|
28
|
+
console.error(error);
|
29
|
+
});
|
30
|
+
```
|
31
|
+
|
32
|
+
## Features
|
33
|
+
|
34
|
+
- Simple and easy to use
|
35
|
+
- Many feature scraping
|
36
|
+
- You can install the package that you will use
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
If you find a bug or have a feature request, please open an issue on our GitHub repository.
|
41
|
+
|
42
|
+
We welcome contributions from the community. If you'd like to contribute, please fork the repository and submit a pull request.
|
43
|
+
|
44
|
+
## License
|
45
|
+
|
46
|
+
Scraper is licensed under the GPL-3.0-or-later license. See [LICENSE](LICENSE) for more information.
|
package/package.json
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"name": "abot-scraper",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "scraper random",
|
5
|
+
"main": "src/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"test": "npm test"
|
8
|
+
},
|
9
|
+
"keywords": [
|
10
|
+
"scraper"
|
11
|
+
],
|
12
|
+
"author": "Ahlul Mukhramin",
|
13
|
+
"license": "ISC",
|
14
|
+
"dependencies": {
|
15
|
+
"axios": "^1.5.1",
|
16
|
+
"cheerio": "^1.0.0-rc.12"
|
17
|
+
}
|
18
|
+
}
|
package/src/index.js
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
const { default: axios } = require("axios");
|
2
|
+
const cheerio = require("cheerio");
|
3
|
+
global.creator = `@abotscraper – ahmuq`;
|
4
|
+
|
5
|
+
function facebook(url) {
|
6
|
+
return new Promise((resolve, reject) => {
|
7
|
+
let config = {
|
8
|
+
url: url,
|
9
|
+
};
|
10
|
+
let headerss = {
|
11
|
+
"sec-ch-ua":
|
12
|
+
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
13
|
+
"user-agent":
|
14
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
15
|
+
Cookie:
|
16
|
+
'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}',
|
17
|
+
};
|
18
|
+
axios("https://www.getfvid.com/downloader", {
|
19
|
+
method: "POST",
|
20
|
+
data: new URLSearchParams(Object.entries(config)),
|
21
|
+
headers: headerss,
|
22
|
+
})
|
23
|
+
.then(({ data }) => {
|
24
|
+
const $ = cheerio.load(data);
|
25
|
+
const title = $(".card-title a").text().trim();
|
26
|
+
const links = {
|
27
|
+
hd: "",
|
28
|
+
sd: "",
|
29
|
+
audio: "",
|
30
|
+
};
|
31
|
+
|
32
|
+
$(".btns-download a").each((index, element) => {
|
33
|
+
const link = $(element).attr("href");
|
34
|
+
const text = $(element).text(); // Ambil teks dari link untuk menentukan jenis link
|
35
|
+
if (text.includes("HD Quality")) {
|
36
|
+
links.hd = link;
|
37
|
+
} else if (text.includes("Normal Quality")) {
|
38
|
+
links.sd = link;
|
39
|
+
} else if (text.includes("Audio Only")) {
|
40
|
+
links.audio = link;
|
41
|
+
}
|
42
|
+
});
|
43
|
+
|
44
|
+
resolve({
|
45
|
+
creator: global.creator,
|
46
|
+
status: 200,
|
47
|
+
result: {
|
48
|
+
title: title,
|
49
|
+
hd: links.hd,
|
50
|
+
sd: links.sd,
|
51
|
+
audio: links.audio,
|
52
|
+
},
|
53
|
+
});
|
54
|
+
})
|
55
|
+
.catch(reject);
|
56
|
+
});
|
57
|
+
}
|
58
|
+
|
59
|
+
function igstory(username) {
|
60
|
+
return new Promise(async (resolve) => {
|
61
|
+
try {
|
62
|
+
const data = await axios.get(
|
63
|
+
"https://insta-stories-viewer.com/" + username
|
64
|
+
);
|
65
|
+
const userIdRegex = /var USER_ID = (\d+);/;
|
66
|
+
const match = data.data.match(userIdRegex);
|
67
|
+
const userId = parseInt(match[1]);
|
68
|
+
const hasil = await axios.get(
|
69
|
+
"https://igs.sf-converter.com/api/stories/" + userId
|
70
|
+
);
|
71
|
+
const result = [];
|
72
|
+
hasil.data.result.forEach((item, index) => {
|
73
|
+
const imageUrl =
|
74
|
+
item.image_versions2 &&
|
75
|
+
item.image_versions2.candidates &&
|
76
|
+
item.image_versions2.candidates.length > 0
|
77
|
+
? item.image_versions2.candidates[0].url
|
78
|
+
: null;
|
79
|
+
const videoUrl =
|
80
|
+
item.video_versions && item.video_versions.length > 0
|
81
|
+
? item.video_versions[0].url
|
82
|
+
: null;
|
83
|
+
result.push(imageUrl);
|
84
|
+
if (videoUrl) {
|
85
|
+
result.push(videoUrl);
|
86
|
+
}
|
87
|
+
resolve({
|
88
|
+
creator: global.creator,
|
89
|
+
status: 200,
|
90
|
+
result: result,
|
91
|
+
});
|
92
|
+
});
|
93
|
+
} catch (error) {
|
94
|
+
console.log(error);
|
95
|
+
return resolve({
|
96
|
+
creator: global.creator,
|
97
|
+
status: false,
|
98
|
+
});
|
99
|
+
}
|
100
|
+
});
|
101
|
+
}
|
102
|
+
|
103
|
+
instagram = (url) => {
|
104
|
+
return new Promise((resolve, reject) => {
|
105
|
+
let config = {
|
106
|
+
url: url,
|
107
|
+
lang_code: "en",
|
108
|
+
token: "",
|
109
|
+
};
|
110
|
+
let headerss = {
|
111
|
+
"sec-ch-ua":
|
112
|
+
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
113
|
+
"user-agent":
|
114
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
115
|
+
Cookie:
|
116
|
+
'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}',
|
117
|
+
};
|
118
|
+
axios("https://fastdl.app/c/", {
|
119
|
+
method: "POST",
|
120
|
+
data: new URLSearchParams(Object.entries(config)),
|
121
|
+
headers: headerss,
|
122
|
+
})
|
123
|
+
.then(({ data }) => {
|
124
|
+
const $ = cheerio.load(data);
|
125
|
+
const downloadLinks = [];
|
126
|
+
$("a[href]").each((index, element) => {
|
127
|
+
const hrefValue = $(element).attr("href");
|
128
|
+
downloadLinks.push(hrefValue);
|
129
|
+
});
|
130
|
+
resolve({
|
131
|
+
creator: global.creator,
|
132
|
+
status: 200,
|
133
|
+
result: downloadLinks,
|
134
|
+
});
|
135
|
+
})
|
136
|
+
.catch(({ error }) => {
|
137
|
+
reject(error);
|
138
|
+
});
|
139
|
+
});
|
140
|
+
};
|
141
|
+
|
142
|
+
function ytMP3(url) {
|
143
|
+
return new Promise((resolve, reject) => {
|
144
|
+
let configd = {
|
145
|
+
k_query: url,
|
146
|
+
k_page: "Youtube Downloader",
|
147
|
+
hl: "en",
|
148
|
+
q_auto: 0,
|
149
|
+
};
|
150
|
+
let headerss = {
|
151
|
+
"sec-ch-ua":
|
152
|
+
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
153
|
+
"user-agent":
|
154
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
155
|
+
Cookie:
|
156
|
+
'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}',
|
157
|
+
};
|
158
|
+
axios("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
159
|
+
method: "POST",
|
160
|
+
data: new URLSearchParams(Object.entries(configd)),
|
161
|
+
headers: headerss,
|
162
|
+
})
|
163
|
+
.then(({ data }) => {
|
164
|
+
let url = "https://www.youtube.com/watch?v=" + data.vid;
|
165
|
+
let configimg = {
|
166
|
+
url: "https://www.youtube.be/" + url,
|
167
|
+
q_auto: 0,
|
168
|
+
ajax: 1,
|
169
|
+
};
|
170
|
+
let configdl = {
|
171
|
+
vid: data.vid,
|
172
|
+
k: data.links.mp3.mp3128.k,
|
173
|
+
};
|
174
|
+
let size = data.links.mp3.mp3128.size;
|
175
|
+
axios("https://www.y2mate.com/mates/en68/analyze/ajax", {
|
176
|
+
method: "POST",
|
177
|
+
data: new URLSearchParams(Object.entries(configimg)),
|
178
|
+
headers: headerss,
|
179
|
+
}).then(({ data }) => {
|
180
|
+
const $ = cheerio.load(data.result);
|
181
|
+
let img = $("div.thumbnail.cover > a > img").attr("src");
|
182
|
+
axios("https://www.y2mate.com/mates/convertV2/index", {
|
183
|
+
method: "POST",
|
184
|
+
data: new URLSearchParams(Object.entries(configdl)),
|
185
|
+
headers: headerss,
|
186
|
+
}).then(({ data }) => {
|
187
|
+
resolve({
|
188
|
+
creator: global.creator,
|
189
|
+
status: 200,
|
190
|
+
result: {
|
191
|
+
title: data.title,
|
192
|
+
ftype: data.ftype,
|
193
|
+
quality: data.fquality,
|
194
|
+
thumb: img,
|
195
|
+
size_mp3: size,
|
196
|
+
link: data.dlink,
|
197
|
+
},
|
198
|
+
});
|
199
|
+
});
|
200
|
+
});
|
201
|
+
})
|
202
|
+
.catch(reject);
|
203
|
+
});
|
204
|
+
}
|
205
|
+
|
206
|
+
function ytMP4(url) {
|
207
|
+
return new Promise((resolve, reject) => {
|
208
|
+
let configd = {
|
209
|
+
k_query: url,
|
210
|
+
k_page: "Youtube Downloader",
|
211
|
+
hl: "en",
|
212
|
+
q_auto: 0,
|
213
|
+
};
|
214
|
+
let headerss = {
|
215
|
+
"sec-ch-ua":
|
216
|
+
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
217
|
+
"user-agent":
|
218
|
+
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
219
|
+
Cookie:
|
220
|
+
'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}',
|
221
|
+
};
|
222
|
+
axios("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
223
|
+
method: "POST",
|
224
|
+
data: new URLSearchParams(Object.entries(configd)),
|
225
|
+
headers: headerss,
|
226
|
+
})
|
227
|
+
.then(({ data }) => {
|
228
|
+
let url = "https://www.youtube.com/watch?v=" + data.vid;
|
229
|
+
let configimg = {
|
230
|
+
url: "https://www.youtube.be/" + url,
|
231
|
+
q_auto: 0,
|
232
|
+
ajax: 1,
|
233
|
+
};
|
234
|
+
let configdl = {
|
235
|
+
vid: data.vid,
|
236
|
+
k: data.links.mp4[135].k,
|
237
|
+
};
|
238
|
+
let size = data.links.mp4[135].size;
|
239
|
+
axios("https://www.y2mate.com/mates/en68/analyze/ajax", {
|
240
|
+
method: "POST",
|
241
|
+
data: new URLSearchParams(Object.entries(configimg)),
|
242
|
+
headers: headerss,
|
243
|
+
}).then(({ data }) => {
|
244
|
+
const $ = cheerio.load(data.result);
|
245
|
+
let img = $("div.thumbnail.cover > a > img").attr("src");
|
246
|
+
axios("https://www.y2mate.com/mates/convertV2/index", {
|
247
|
+
method: "POST",
|
248
|
+
data: new URLSearchParams(Object.entries(configdl)),
|
249
|
+
headers: headerss,
|
250
|
+
}).then(({ data }) => {
|
251
|
+
resolve({
|
252
|
+
creator: global.creator,
|
253
|
+
status: 200,
|
254
|
+
result: {
|
255
|
+
title: data.title,
|
256
|
+
ftype: data.ftype,
|
257
|
+
thumb: img,
|
258
|
+
size_mp4: size,
|
259
|
+
link: data.dlink,
|
260
|
+
},
|
261
|
+
});
|
262
|
+
});
|
263
|
+
});
|
264
|
+
})
|
265
|
+
.catch(reject);
|
266
|
+
});
|
267
|
+
}
|
268
|
+
|
269
|
+
module.exports = {
|
270
|
+
facebook,
|
271
|
+
igstory,
|
272
|
+
instagram,
|
273
|
+
ytMP3,
|
274
|
+
ytMP4,
|
275
|
+
};
|