Skip to content

Commit c810f75

Browse files
committed
wip
1 parent 7085610 commit c810f75

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

dist/index/index.crawler.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index/index.crawler.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index/index.crawler.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,25 @@
1-
import { bodyToComicListNew, GET } from "../util";
1+
import { BASE_URL, bodyToComicListNew, GET, log } from "../util";
22
import { Comic } from "../models/comic.interface";
33

44
export class Crawler {
5+
static buildUrl(type: string, page: number): string {
6+
const url = `${BASE_URL}/manga_list/?type=${type}&category=all&state=all&page=${page}`;
7+
log(`GET ${url}`);
8+
return url;
9+
}
10+
511
static async newestComics(page: number): Promise<Comic[]> {
6-
const body = await GET(`https://ww.mangakakalot.tv/manga_list/?type=newest&category=all&state=all&page=${page}`);
12+
const body = await GET(Crawler.buildUrl('newest', page));
713
return bodyToComicListNew(body);
814
}
915

1016
static async updatedComics(page: number): Promise<Comic[]> {
11-
const body = await GET(`https://manganato.com/genre-all/${page}`);
17+
const body = await GET(Crawler.buildUrl('latest', page));
1218
return bodyToComicListNew(body);
1319
}
1420

1521
static async mostViewedComics(page: number): Promise<Comic[]> {
16-
const body = await GET(`https://manganato.com/genre-all/${page}?type=topview`);
22+
const body = await GET(Crawler.buildUrl('topview', page));
1723
return bodyToComicListNew(body);
1824
}
1925
}

0 commit comments

Comments
 (0)