Skip to content

Commit 76c876c

Browse files
akn19MikeZeDev
andauthored
add connector reyume (#7940)
* add connector reyume * improves code readability & maintainability * fix lint --------- Co-authored-by: MikeZeDev <[email protected]>
1 parent 1f98cb1 commit 76c876c

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

src/web/img/connectors/reyume

9.44 KB
Binary file not shown.

src/web/mjs/connectors/Reyume.mjs

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import Connector from '../engine/Connector.mjs';
2+
import Manga from '../engine/Manga.mjs';
3+
export default class Reyume extends Connector {
4+
constructor() {
5+
super();
6+
super.id = 'reyume';
7+
super.label = 'ReYume';
8+
this.tags = [ 'manga', 'scanlation', 'indonesian' ];
9+
this.url = 'https://www.re-yume.my.id';
10+
}
11+
12+
async _getMangas() {
13+
const mangalist = [];
14+
const request = new Request(new URL('/feeds/posts/default/-/Series?orderby=published&alt=json&max-results=999', this.url), this.requestOptions);
15+
const { feed } = await this.fetchJSON(request);
16+
feed.entry.map(manga => {
17+
const goodLink = manga.link.find(link => link.rel === 'alternate');
18+
mangalist.push({
19+
id: this.getRootRelativeOrAbsoluteLink(goodLink.href, request.url),
20+
title: goodLink.title.trim()
21+
});
22+
});
23+
return mangalist;
24+
}
25+
26+
async _getChapters(manga) {
27+
let request = new Request(new URL(manga.id, this.url), this.requestOptions);
28+
const mangaid = await Engine.Request.fetchUI(request, 'clwd.settings.cat');
29+
30+
request = new Request(new URL('/feeds/posts/default/-/'+mangaid+'?orderby=published&alt=json&max-results=9999', this.url), this.requestOptions);
31+
const { feed } = await this.fetchJSON(request);
32+
33+
const chapterslist = feed.entry.map(entry => {
34+
const goodLink = entry.link.find(link => link.rel === 'alternate');
35+
return {
36+
id: this.getRootRelativeOrAbsoluteLink(goodLink.href, request.url),
37+
title: goodLink.title.replace(manga.title, '').trim()
38+
};
39+
}).filter(chap => chap.id != manga.id);
40+
return chapterslist;
41+
}
42+
43+
async _getChapterListFromPages(manga, mangaid) {
44+
const request = new Request(new URL('/feeds/posts/default/-/'+mangaid+'?orderby=published&alt=json&max-results=999', this.url), this.requestOptions);
45+
const { feed } = await this.fetchJSON(request);
46+
47+
const chapterslist = feed.entry.map((entry) => {
48+
const goodLink = entry.link.find((link) => link.rel === "alternate");
49+
return {
50+
id: this.getRootRelativeOrAbsoluteLink(goodLink.href, request.url),
51+
title: goodLink.title.replace(/.*(?=Chapter)/g, "").trim(),
52+
};
53+
}).filter((chap) => chap.id != manga.id);
54+
return chapterslist;
55+
}
56+
57+
async _getPages(chapter) {
58+
const scriptPages = `
59+
new Promise(resolve => {
60+
resolve([...document.querySelectorAll('article#reader img')].map(img => img.src));
61+
});
62+
`;
63+
const request = new Request(new URL(chapter.id, this.url), this.requestOptions);
64+
return await Engine.Request.fetchUI(request, scriptPages);
65+
}
66+
67+
async _getMangaFromURI(uri) {
68+
const request = new Request(uri, this.requestOptions);
69+
const title = (await this.fetchDOM(request, 'h1[itemprop="name"]'))[0].textContent.trim();
70+
return new Manga(this, uri.pathname, title);
71+
}
72+
}

0 commit comments

Comments
 (0)