abot-scraper 1.1.2 → 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/license +21 -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/package.json
CHANGED
@@ -1,24 +1,66 @@
|
|
1
|
-
{
|
2
|
-
"name": "abot-scraper",
|
3
|
-
"version": "1.
|
4
|
-
"description": "scraper random for downloader and searching",
|
5
|
-
"
|
6
|
-
"
|
7
|
-
|
8
|
-
|
9
|
-
"
|
10
|
-
"
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
"
|
22
|
-
|
23
|
-
|
24
|
-
|
1
|
+
{
|
2
|
+
"name": "abot-scraper",
|
3
|
+
"version": "1.2.0",
|
4
|
+
"description": "scraper random for downloader and searching",
|
5
|
+
"type": "module",
|
6
|
+
"main": "./dist/index.js",
|
7
|
+
"module": "./dist/index.js",
|
8
|
+
"types": "./dist/index.d.ts",
|
9
|
+
"exports": {
|
10
|
+
".": {
|
11
|
+
"types": "./dist/index.d.ts",
|
12
|
+
"import": "./dist/index.js",
|
13
|
+
"require": "./dist/index.cjs"
|
14
|
+
}
|
15
|
+
},
|
16
|
+
"files": [
|
17
|
+
"dist",
|
18
|
+
"types"
|
19
|
+
],
|
20
|
+
"engines": {
|
21
|
+
"node": ">=18.0.0"
|
22
|
+
},
|
23
|
+
"scripts": {
|
24
|
+
"build": "tsup",
|
25
|
+
"build:watch": "tsup --watch",
|
26
|
+
"lint": "eslint src/**/*.ts --fix",
|
27
|
+
"lint:check": "eslint src/**/*.ts",
|
28
|
+
"type-check": "tsc --noEmit",
|
29
|
+
"dev": "tsup --watch",
|
30
|
+
"prepublishOnly": "npm run build",
|
31
|
+
"test": "npm run lint:check && npm run type-check && npm run build",
|
32
|
+
"publish:dry": "npm publish --dry-run"
|
33
|
+
},
|
34
|
+
"keywords": [
|
35
|
+
"scraper",
|
36
|
+
"downloader",
|
37
|
+
"ytdownloader",
|
38
|
+
"instagram",
|
39
|
+
"youtube-dl",
|
40
|
+
"youtube",
|
41
|
+
"facebook",
|
42
|
+
"tiktok",
|
43
|
+
"social-media",
|
44
|
+
"video-downloader",
|
45
|
+
"dual-package",
|
46
|
+
"esm",
|
47
|
+
"commonjs",
|
48
|
+
"typescript"
|
49
|
+
],
|
50
|
+
"author": "Ahlul Mukhramin",
|
51
|
+
"license": "MIT",
|
52
|
+
"dependencies": {
|
53
|
+
"axios": "^1.5.1",
|
54
|
+
"cheerio": "^1.0.0-rc.12",
|
55
|
+
"qs": "^6.14.0"
|
56
|
+
},
|
57
|
+
"devDependencies": {
|
58
|
+
"@types/node": "^22.15.27",
|
59
|
+
"@types/qs": "^6.9.15",
|
60
|
+
"eslint": "^9.0.0",
|
61
|
+
"prettier": "^3.3.0",
|
62
|
+
"tsup": "^8.5.0",
|
63
|
+
"typescript": "^5.5.0",
|
64
|
+
"typescript-eslint": "^8.0.0"
|
65
|
+
}
|
66
|
+
}
|
package/types/index.d.ts
ADDED
@@ -0,0 +1,172 @@
|
|
1
|
+
export interface ApiResponse<T = any> {
|
2
|
+
creator: string;
|
3
|
+
status: number | boolean;
|
4
|
+
result?: T;
|
5
|
+
msg?: string;
|
6
|
+
}
|
7
|
+
|
8
|
+
export interface FacebookResult {
|
9
|
+
thumbnail: string;
|
10
|
+
videoUrl: string;
|
11
|
+
}
|
12
|
+
|
13
|
+
export interface TikTokResult {
|
14
|
+
title: string;
|
15
|
+
video: string;
|
16
|
+
audio: string;
|
17
|
+
}
|
18
|
+
|
19
|
+
export interface InstagramUserInfo {
|
20
|
+
username: string;
|
21
|
+
[key: string]: any;
|
22
|
+
}
|
23
|
+
|
24
|
+
export interface InstagramStoriesResult {
|
25
|
+
user_info: InstagramUserInfo;
|
26
|
+
links: string[];
|
27
|
+
}
|
28
|
+
|
29
|
+
export interface InstagramMediaItem {
|
30
|
+
type: "video" | "image";
|
31
|
+
url: string;
|
32
|
+
}
|
33
|
+
|
34
|
+
export interface YouTubeDownloadLinks {
|
35
|
+
"480p"?: string;
|
36
|
+
"720p"?: string;
|
37
|
+
"1080p"?: string;
|
38
|
+
}
|
39
|
+
|
40
|
+
export interface YouTubeResult {
|
41
|
+
title: string;
|
42
|
+
thumbnail: string;
|
43
|
+
downloadLinks: YouTubeDownloadLinks;
|
44
|
+
mp3DownloadUrl: string;
|
45
|
+
}
|
46
|
+
|
47
|
+
export interface SFileDownloadResult {
|
48
|
+
filename: string;
|
49
|
+
mimetype: string;
|
50
|
+
download: string;
|
51
|
+
}
|
52
|
+
|
53
|
+
export interface SFileSearchItem {
|
54
|
+
title: string;
|
55
|
+
size: string;
|
56
|
+
link: string;
|
57
|
+
}
|
58
|
+
|
59
|
+
export interface YouTubePlayResult {
|
60
|
+
status: string;
|
61
|
+
title: string;
|
62
|
+
ftype: string;
|
63
|
+
thumb: string;
|
64
|
+
size_mp3: string;
|
65
|
+
link: string;
|
66
|
+
}
|
67
|
+
|
68
|
+
export interface WallpaperItem {
|
69
|
+
title: string;
|
70
|
+
type: string;
|
71
|
+
source: string;
|
72
|
+
image: string[];
|
73
|
+
}
|
74
|
+
|
75
|
+
export interface WikimediaItem {
|
76
|
+
title: string;
|
77
|
+
source: string;
|
78
|
+
image: string;
|
79
|
+
}
|
80
|
+
|
81
|
+
export interface SfileSearchResult {
|
82
|
+
title: string;
|
83
|
+
size: string;
|
84
|
+
link: string;
|
85
|
+
}
|
86
|
+
|
87
|
+
export interface YtPlayResult {
|
88
|
+
status: string;
|
89
|
+
title: string;
|
90
|
+
ftype: string;
|
91
|
+
thumb: string;
|
92
|
+
size_mp3: string;
|
93
|
+
link: string;
|
94
|
+
}
|
95
|
+
|
96
|
+
export interface WallpaperResult {
|
97
|
+
title: string;
|
98
|
+
type: string;
|
99
|
+
source: string;
|
100
|
+
image: string[];
|
101
|
+
}
|
102
|
+
|
103
|
+
export interface WikimediaResult {
|
104
|
+
title: string;
|
105
|
+
source: string;
|
106
|
+
image: string;
|
107
|
+
}
|
108
|
+
|
109
|
+
export interface YtSearchResult {
|
110
|
+
title: string;
|
111
|
+
thumbnail: string;
|
112
|
+
url: string;
|
113
|
+
}
|
114
|
+
|
115
|
+
export interface YoutubeResult {
|
116
|
+
title: string;
|
117
|
+
thumbnail: string;
|
118
|
+
downloadLinks: Record<string, string>;
|
119
|
+
mp3DownloadUrl: string;
|
120
|
+
}
|
121
|
+
|
122
|
+
export interface YoutubeResultV2 {
|
123
|
+
title: string;
|
124
|
+
thumbnail: string | null;
|
125
|
+
downloadLinks: Record<string, string>;
|
126
|
+
video: string | null;
|
127
|
+
audio: string | null;
|
128
|
+
formats: any[];
|
129
|
+
}
|
130
|
+
|
131
|
+
export interface SfileDownloadResult {
|
132
|
+
filename: string;
|
133
|
+
mimetype: string;
|
134
|
+
download: string;
|
135
|
+
}
|
136
|
+
|
137
|
+
export declare class Downloader {
|
138
|
+
facebook(url: string): Promise<ApiResponse<FacebookResult>>;
|
139
|
+
|
140
|
+
tiktokDownloader(url: string): Promise<ApiResponse<TikTokResult>>;
|
141
|
+
|
142
|
+
igstory(username: string): Promise<ApiResponse<InstagramStoriesResult>>;
|
143
|
+
|
144
|
+
instagram(url: string): Promise<ApiResponse<InstagramMediaItem[]>>;
|
145
|
+
|
146
|
+
youtubeDownloader(url: string): Promise<ApiResponse<YouTubeResult>>;
|
147
|
+
|
148
|
+
sfileDownloader(url: string): Promise<ApiResponse<SFileDownloadResult>>;
|
149
|
+
}
|
150
|
+
|
151
|
+
export declare class Search {
|
152
|
+
sfileSearch(query: string, page?: number): Promise<ApiResponse<SFileSearchItem[]>>;
|
153
|
+
|
154
|
+
ytSearch(query: string): Promise<ApiResponse<YtSearchResult[]>>;
|
155
|
+
|
156
|
+
ytPlay(text: string): Promise<ApiResponse<YouTubePlayResult>>;
|
157
|
+
|
158
|
+
wallpaper(title: string, page?: string): Promise<ApiResponse<WallpaperItem[]>>;
|
159
|
+
|
160
|
+
wikimedia(title: string): Promise<ApiResponse<WikimediaItem[]>>;
|
161
|
+
}
|
162
|
+
|
163
|
+
export declare const downloader: Downloader;
|
164
|
+
|
165
|
+
export declare const search: Search;
|
166
|
+
|
167
|
+
declare const abot: {
|
168
|
+
downloader: Downloader;
|
169
|
+
search: Search;
|
170
|
+
};
|
171
|
+
|
172
|
+
export default abot;
|
package/src/index.js
DELETED
@@ -1,215 +0,0 @@
|
|
1
|
-
const { default: axios } = require("axios");
|
2
|
-
const cheerio = require("cheerio");
|
3
|
-
const qs = require("qs");
|
4
|
-
global.creator = `@abotscraper – ahmuq`;
|
5
|
-
|
6
|
-
module.exports = class Downloader {
|
7
|
-
async facebook(url) {
|
8
|
-
try {
|
9
|
-
const headers = {
|
10
|
-
"User-Agent":
|
11
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 Edg/134.0.0.0",
|
12
|
-
Origin: "https://www.fdown.world",
|
13
|
-
referer: "https://www.fdown.world/",
|
14
|
-
"x-requested-with": "XMLHttpRequest",
|
15
|
-
Cookie: "codehap_domain=www.fdown.world",
|
16
|
-
};
|
17
|
-
|
18
|
-
const data = new URLSearchParams({ codehap_link: url, codehap: "true" });
|
19
|
-
|
20
|
-
const response = await axios.post(
|
21
|
-
"https://www.fdown.world/result.php",
|
22
|
-
data,
|
23
|
-
{ headers }
|
24
|
-
);
|
25
|
-
|
26
|
-
const $ = cheerio.load(response.data);
|
27
|
-
const videoUrl = $("video source").attr("src");
|
28
|
-
const imageUrl = $("img").attr("src");
|
29
|
-
|
30
|
-
return {
|
31
|
-
creator: global.creator,
|
32
|
-
status: 200,
|
33
|
-
result: {
|
34
|
-
thumbnail: imageUrl,
|
35
|
-
videoUrl: videoUrl,
|
36
|
-
},
|
37
|
-
};
|
38
|
-
} catch (error) {
|
39
|
-
return { creator: global.creator, status: false, msg: error.message };
|
40
|
-
}
|
41
|
-
}
|
42
|
-
|
43
|
-
async tiktokDownloader(url) {
|
44
|
-
try {
|
45
|
-
const headers = {
|
46
|
-
"sec-ch-ua":
|
47
|
-
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
48
|
-
"user-agent":
|
49
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
50
|
-
};
|
51
|
-
|
52
|
-
const data = new URLSearchParams({
|
53
|
-
id: url,
|
54
|
-
locale: "en",
|
55
|
-
tt: "WmNzZDk_",
|
56
|
-
});
|
57
|
-
|
58
|
-
const response = await axios.post("https://ssstik.io/abc?url=dl", data, {
|
59
|
-
headers,
|
60
|
-
});
|
61
|
-
|
62
|
-
const $ = cheerio.load(response.data);
|
63
|
-
const title = $("p.maintext").text().trim();
|
64
|
-
const audio = $("a.download_link.music").attr("href");
|
65
|
-
const video = $("a.download_link.without_watermark").attr("href");
|
66
|
-
|
67
|
-
return {
|
68
|
-
creator: global.creator,
|
69
|
-
status: 200,
|
70
|
-
result: {
|
71
|
-
title: title,
|
72
|
-
video: video,
|
73
|
-
audio: audio,
|
74
|
-
},
|
75
|
-
};
|
76
|
-
} catch (error) {
|
77
|
-
return { creator: global.creator, status: false, msg: error.message };
|
78
|
-
}
|
79
|
-
}
|
80
|
-
|
81
|
-
async igstory(username) {
|
82
|
-
function encodeParameter(username) {
|
83
|
-
const parameter = `-1::${username}::rJP2tBRKf6ktbRqPUBtRE9klgBWb7d`;
|
84
|
-
let encoded = Buffer.from(parameter).toString("base64");
|
85
|
-
return encoded
|
86
|
-
.replace(/[+]/g, ".")
|
87
|
-
.replace(/[/]/g, "_")
|
88
|
-
.replace(/[=]/g, "-");
|
89
|
-
}
|
90
|
-
|
91
|
-
try {
|
92
|
-
const headers = {
|
93
|
-
"User-Agent":
|
94
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/",
|
95
|
-
};
|
96
|
-
|
97
|
-
const encodedParameter = encodeParameter(username);
|
98
|
-
const response = await axios.get(
|
99
|
-
`https://instanavigation.net/api/v1/stories/${encodedParameter}`,
|
100
|
-
{ headers }
|
101
|
-
);
|
102
|
-
|
103
|
-
const data = response.data;
|
104
|
-
const sources = data.stories.map((story) => story.source);
|
105
|
-
|
106
|
-
return {
|
107
|
-
creator: global.creator,
|
108
|
-
status: 200,
|
109
|
-
result: {
|
110
|
-
user_info: data.user_info,
|
111
|
-
links: sources,
|
112
|
-
},
|
113
|
-
};
|
114
|
-
} catch (error) {
|
115
|
-
return { creator: global.creator, status: false, msg: error.message };
|
116
|
-
}
|
117
|
-
}
|
118
|
-
|
119
|
-
async instagram(url) {
|
120
|
-
try {
|
121
|
-
const config = new URLSearchParams({
|
122
|
-
url: url,
|
123
|
-
new: 2,
|
124
|
-
lang: "en",
|
125
|
-
app: "",
|
126
|
-
});
|
127
|
-
|
128
|
-
const headers = {
|
129
|
-
"user-agent":
|
130
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
131
|
-
};
|
132
|
-
|
133
|
-
const response = await axios.post(
|
134
|
-
"https://snapinsta.app/get-data.php",
|
135
|
-
config,
|
136
|
-
{ headers }
|
137
|
-
);
|
138
|
-
|
139
|
-
const downloadLinks = response.data.files
|
140
|
-
.map((file) =>
|
141
|
-
file.__type === "GraphVideo"
|
142
|
-
? { type: "video", url: file.video_url }
|
143
|
-
: file.__type === "GraphImage"
|
144
|
-
? { type: "image", url: file.download_url }
|
145
|
-
: null
|
146
|
-
)
|
147
|
-
.filter((link) => link !== null);
|
148
|
-
|
149
|
-
return {
|
150
|
-
creator: global.creator,
|
151
|
-
status: 200,
|
152
|
-
result: downloadLinks,
|
153
|
-
};
|
154
|
-
} catch (error) {
|
155
|
-
return { creator: global.creator, status: false, msg: error.message };
|
156
|
-
}
|
157
|
-
}
|
158
|
-
|
159
|
-
async youtubeDownloader(url) {
|
160
|
-
try {
|
161
|
-
const config = qs.stringify({ url: url, q_auto: 0, ajax: 1, lang: "en" });
|
162
|
-
|
163
|
-
const headers = {
|
164
|
-
"user-agent":
|
165
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
166
|
-
};
|
167
|
-
|
168
|
-
const response = await axios.post(
|
169
|
-
"https://yt1s.net/ajax?retry=undefined&platform=youtube",
|
170
|
-
config,
|
171
|
-
{ headers }
|
172
|
-
);
|
173
|
-
|
174
|
-
const $ = cheerio.load(response.data.result);
|
175
|
-
const title = $(".caption b").text().trim();
|
176
|
-
const downloadLinks = {
|
177
|
-
"480p": $('a[data-fquality="480p"]').attr("href"),
|
178
|
-
"720p": $('a[data-fquality="720p"]').attr("href"),
|
179
|
-
"1080p": $('a[data-fquality="1080p"]').attr("href"),
|
180
|
-
};
|
181
|
-
const thumbnailUrl = $(".thumbnail.cover img").attr("src");
|
182
|
-
|
183
|
-
const mp3ConvertElement = $("#convert-mp3 a");
|
184
|
-
const hrefAttr = mp3ConvertElement.attr("href");
|
185
|
-
|
186
|
-
if (!hrefAttr) throw new Error("MP3 conversion link not found.");
|
187
|
-
|
188
|
-
const mp3ConvertTokenMatch = hrefAttr.match(
|
189
|
-
/mp3_convert_task\('(\d+)',\s*'([^']+)'\)/
|
190
|
-
);
|
191
|
-
|
192
|
-
if (!mp3ConvertTokenMatch)
|
193
|
-
throw new Error("MP3 conversion token not found.");
|
194
|
-
|
195
|
-
const mp3ConvertToken = mp3ConvertTokenMatch[2];
|
196
|
-
|
197
|
-
const mp3Response = await axios.get(
|
198
|
-
`https://api.fabdl.com/youtube/mp3-convert-task?token=${mp3ConvertToken}`
|
199
|
-
);
|
200
|
-
|
201
|
-
return {
|
202
|
-
creator: global.creator,
|
203
|
-
status: true,
|
204
|
-
result: {
|
205
|
-
title: title,
|
206
|
-
thumbnail: thumbnailUrl,
|
207
|
-
downloadLinks: downloadLinks,
|
208
|
-
mp3DownloadUrl: `https://api.fabdl.com${mp3Response.data.result.download_url}`,
|
209
|
-
},
|
210
|
-
};
|
211
|
-
} catch (error) {
|
212
|
-
return { creator: global.creator, status: false, msg: error.message };
|
213
|
-
}
|
214
|
-
}
|
215
|
-
};
|
package/src/scraper/search.js
DELETED
@@ -1,144 +0,0 @@
|
|
1
|
-
const { default: axios } = require("axios");
|
2
|
-
const cheerio = require("cheerio");
|
3
|
-
global.creator = `@abotscraper – ahmuq`;
|
4
|
-
|
5
|
-
module.exports = class Search {
|
6
|
-
ytPlay = (text) => {
|
7
|
-
return new Promise((resolve, reject) => {
|
8
|
-
let configd = {
|
9
|
-
k_query: text,
|
10
|
-
k_page: "mp3",
|
11
|
-
q_auto: 1,
|
12
|
-
};
|
13
|
-
let headerss = {
|
14
|
-
"sec-ch-ua":
|
15
|
-
'" Not;A Brand";v="99", "Google Chrome";v="91", "Chromium";v="91"',
|
16
|
-
"user-agent":
|
17
|
-
"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
|
18
|
-
Cookie:
|
19
|
-
'PHPSESSID=6jo2ggb63g5mjvgj45f612ogt7; _ga=GA1.2.405896420.1625200423; _gid=GA1.2.2135261581.1625200423; _PN_SBSCRBR_FALLBACK_DENIED=1625200785624; MarketGidStorage={"0":{},"C702514":{"page":5,"time":1625200846733}}',
|
20
|
-
};
|
21
|
-
|
22
|
-
axios("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
23
|
-
method: "POST",
|
24
|
-
data: new URLSearchParams(Object.entries(configd)),
|
25
|
-
headers: headerss,
|
26
|
-
})
|
27
|
-
.then(({ data }) => {
|
28
|
-
let v = data.vitems;
|
29
|
-
var v2 = v[Math.floor(Math.random() * v.length)].v;
|
30
|
-
let url = "https://www.youtube.com/watch?v=" + v2;
|
31
|
-
let config = {
|
32
|
-
k_query: "https://www.youtube.be/" + url,
|
33
|
-
k_page: "mp3",
|
34
|
-
hl: "en",
|
35
|
-
q_auto: 1,
|
36
|
-
};
|
37
|
-
let config2 = {
|
38
|
-
url: "https://www.youtube.be/" + url,
|
39
|
-
q_auto: 0,
|
40
|
-
ajax: 1,
|
41
|
-
};
|
42
|
-
axios("https://www.y2mate.com/mates/en68/analyze/ajax", {
|
43
|
-
method: "POST",
|
44
|
-
data: new URLSearchParams(Object.entries(config2)),
|
45
|
-
headers: headerss,
|
46
|
-
}).then(({ data }) => {
|
47
|
-
const $ = cheerio.load(data.result);
|
48
|
-
let img = $("div.thumbnail.cover > a > img").attr("src");
|
49
|
-
axios("https://www.y2mate.com/mates/analyzeV2/ajax", {
|
50
|
-
method: "POST",
|
51
|
-
data: new URLSearchParams(Object.entries(config)),
|
52
|
-
headers: headerss,
|
53
|
-
}).then(({ data }) => {
|
54
|
-
const convertConfig = {
|
55
|
-
vid: data.vid,
|
56
|
-
k: data.links.mp3.mp3128.k,
|
57
|
-
};
|
58
|
-
let size = data.links.mp3.mp3128.size;
|
59
|
-
axios("https://www.y2mate.com/mates/convertV2/index", {
|
60
|
-
method: "POST",
|
61
|
-
data: new URLSearchParams(Object.entries(convertConfig)),
|
62
|
-
headers: headerss,
|
63
|
-
})
|
64
|
-
.then((response) => {
|
65
|
-
resolve({
|
66
|
-
creator: global.creator,
|
67
|
-
status: 200,
|
68
|
-
result: {
|
69
|
-
status: response.data.status,
|
70
|
-
title: response.data.title,
|
71
|
-
ftype: response.data.ftype,
|
72
|
-
thumb: img,
|
73
|
-
size_mp3: size,
|
74
|
-
link: response.data.dlink,
|
75
|
-
},
|
76
|
-
});
|
77
|
-
})
|
78
|
-
.catch(reject);
|
79
|
-
});
|
80
|
-
});
|
81
|
-
})
|
82
|
-
.catch(reject);
|
83
|
-
});
|
84
|
-
};
|
85
|
-
|
86
|
-
wallpaper = (title, page = "1") => {
|
87
|
-
return new Promise((resolve, reject) => {
|
88
|
-
axios
|
89
|
-
.get(
|
90
|
-
`https://www.besthdwallpaper.com/search?CurrentPage=${page}&q=${title}`
|
91
|
-
)
|
92
|
-
.then(({ data }) => {
|
93
|
-
let $ = cheerio.load(data);
|
94
|
-
let hasil = [];
|
95
|
-
|
96
|
-
$("div.grid-item").each(function (a, b) {
|
97
|
-
hasil.push({
|
98
|
-
title: $(b).find("p[title]").attr("title").trim(),
|
99
|
-
type: $(b).find("div.info > a:nth-child(2)").text().trim(),
|
100
|
-
source:
|
101
|
-
"https://www.besthdwallpaper.com" + $(b).find("a").attr("href"),
|
102
|
-
image: [
|
103
|
-
$(b).find("picture > img").attr("src"),
|
104
|
-
$(b).find("picture > source:nth-child(1)").attr("srcset"),
|
105
|
-
$(b).find("picture > source:nth-child(2)").attr("srcset"),
|
106
|
-
],
|
107
|
-
});
|
108
|
-
});
|
109
|
-
resolve({ creator: global.creator, status: 200, hasil });
|
110
|
-
})
|
111
|
-
.catch((error) => {
|
112
|
-
reject(error);
|
113
|
-
});
|
114
|
-
});
|
115
|
-
};
|
116
|
-
|
117
|
-
wikimedia = (title) => {
|
118
|
-
return new Promise((resolve, reject) => {
|
119
|
-
axios
|
120
|
-
.get(
|
121
|
-
`https://commons.wikimedia.org/w/index.php?search=${title}&title=Special:MediaSearch&go=Go&type=image`
|
122
|
-
)
|
123
|
-
.then((res) => {
|
124
|
-
let $ = cheerio.load(res.data);
|
125
|
-
let hasil = [];
|
126
|
-
$(".sdms-search-results__list-wrapper > div > a").each(function (
|
127
|
-
a,
|
128
|
-
b
|
129
|
-
) {
|
130
|
-
hasil.push({
|
131
|
-
title: $(b).find("img").attr("alt"),
|
132
|
-
source: $(b).attr("href"),
|
133
|
-
image:
|
134
|
-
$(b).find("img").attr("data-src") ||
|
135
|
-
$(b).find("img").attr("src"),
|
136
|
-
});
|
137
|
-
});
|
138
|
-
|
139
|
-
resolve({ creator: global.creator, status: 200, hasil });
|
140
|
-
})
|
141
|
-
.catch(reject);
|
142
|
-
});
|
143
|
-
};
|
144
|
-
};
|