Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
hoc081098 committed Nov 26, 2021
1 parent 7085610 commit c810f75
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
11 changes: 8 additions & 3 deletions dist/index/index.crawler.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index/index.crawler.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 10 additions & 4 deletions src/index/index.crawler.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { bodyToComicListNew, GET } from "../util";
import { BASE_URL, bodyToComicListNew, GET, log } from "../util";
import { Comic } from "../models/comic.interface";

export class Crawler {
static buildUrl(type: string, page: number): string {
const url = `${BASE_URL}/manga_list/?type=${type}&category=all&state=all&page=${page}`;
log(`GET ${url}`);
return url;
}

static async newestComics(page: number): Promise<Comic[]> {
const body = await GET(`https://ww.mangakakalot.tv/manga_list/?type=newest&category=all&state=all&page=${page}`);
const body = await GET(Crawler.buildUrl('newest', page));
return bodyToComicListNew(body);
}

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

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

0 comments on commit c810f75

Please sign in to comment.