Update lib/sfilemobi/sfilemobisearch.js
Browse files
lib/sfilemobi/sfilemobisearch.js
CHANGED
@@ -5,18 +5,13 @@ import { DEFAULT_HEADERS } from '../constant.js';
|
|
5 |
import { SfilemobiSearchArgsSchema, SfilemobiSearchSchema } from '../types/sfilemobiesearch-v1.js';
|
6 |
|
7 |
export async function sfilemobiSearch(query, page = 1) {
|
8 |
-
SfilemobiSearchArgsSchema.parse(
|
9 |
|
10 |
const data = await got('https://sfile.mobi/search.php', {
|
11 |
-
searchParams: {
|
12 |
-
|
13 |
-
page
|
14 |
-
},
|
15 |
-
headers: {
|
16 |
-
...DEFAULT_HEADERS
|
17 |
-
}
|
18 |
}).text();
|
19 |
-
|
20 |
const $ = cheerio.load(data);
|
21 |
const results = [];
|
22 |
|
@@ -44,4 +39,4 @@ export async function sfilemobiSearch(query, page = 1) {
|
|
44 |
});
|
45 |
|
46 |
return SfilemobiSearchSchema.parse(results);
|
47 |
-
}
|
|
|
5 |
import { SfilemobiSearchArgsSchema, SfilemobiSearchSchema } from '../types/sfilemobiesearch-v1.js';
|
6 |
|
7 |
export async function sfilemobiSearch(query, page = 1) {
|
8 |
+
SfilemobiSearchArgsSchema.parse({ 0: query, 1: page });
|
9 |
|
10 |
const data = await got('https://sfile.mobi/search.php', {
|
11 |
+
searchParams: { q: query, page },
|
12 |
+
headers: { ...DEFAULT_HEADERS }
|
|
|
|
|
|
|
|
|
|
|
13 |
}).text();
|
14 |
+
|
15 |
const $ = cheerio.load(data);
|
16 |
const results = [];
|
17 |
|
|
|
39 |
});
|
40 |
|
41 |
return SfilemobiSearchSchema.parse(results);
|
42 |
+
}
|