Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/abrclano/miru-repo
Browse files Browse the repository at this point in the history
  • Loading branch information
abrclano committed Feb 19, 2024
2 parents f5cb4cd + f4f73cc commit 06b1e3a
Show file tree
Hide file tree
Showing 4 changed files with 158 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ Miru extensions repository | [Miru App Download](https://github.com/miru-project
| マンガクロス | mangacross.jp | v0.0.1 | OshekharO | jp | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/mangacross.jp.js) |
| MangaDex | mangadex.org | v0.0.2 | bethro | all | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/mangadex.org.js) |
| Mangakatana | mangakatana.com | v0.0.1 | shashankx86 | en | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/mangakatana.com.js) |
| MangaKomi | mangakomi | v0.0.1 | OshekharO | en | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/mangakomi.js) |
| Manganato | manganato | v0.0.1 | OshekharO | en | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/manganato.js) |
| 漫画柜 | manhuagui.com | v0.0.3 | appdevelpo | zh-cn | manga | [Source Code](https://github.com/miru-project/repo/blob/main/repo/manhuagui.com.js) |
| Mikanani | me.mikanani | v0.0.3 | MiaoMint | zh-cn | bangumi | [Source Code](https://github.com/miru-project/repo/blob/main/repo/me.mikanani.js) |
Expand Down
16 changes: 14 additions & 2 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
"type": "bangumi",
"url": "ani.watch.js",
"version": "v0.0.6",
"webSite": "https://aniwatch.to"
"webSite": "https://proxy.techzbots1.workers.dev/?u=https://aniwatch.to"
},
{
"author": "(koikiss-dev)",
Expand Down Expand Up @@ -274,7 +274,7 @@
"package": "com.freexcomic",
"type": "manga",
"url": "com.freexcomic.js",
"version": "v0.0.2",
"version": "v0.0.3",
"webSite": "http://"
},
{
Expand Down Expand Up @@ -763,6 +763,18 @@
"version": "v0.0.1",
"webSite": "https://mangakatana.com/"
},
{
"author": "OshekharO",
"icon": "https://mangakomi.io/wp-content/uploads/2019/12/v-I-BhKu.jpeg",
"lang": "en",
"license": "MIT",
"name": "MangaKomi",
"package": "mangakomi",
"type": "manga",
"url": "mangakomi.js",
"version": "v0.0.1",
"webSite": "https://mangakomi.io"
},
{
"author": "OshekharO",
"icon": "https://manganato.com/themes/hm/images/logo.png",
Expand Down
2 changes: 1 addition & 1 deletion repo/ani.watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
// @icon https://aniwatch.to/images/android-chrome-512x512.png
// @package ani.watch
// @type bangumi
// @webSite https://aniwatch.to
// @webSite https://proxy.techzbots1.workers.dev/?u=https://aniwatch.to
// ==/MiruExtension==

export default class extends Extension {
Expand Down
142 changes: 142 additions & 0 deletions repo/mangakomi.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
// ==MiruExtension==
// @name MangaKomi
// @version v0.0.1
// @author OshekharO
// @lang en
// @license MIT
// @icon https://mangakomi.io/wp-content/uploads/2019/12/v-I-BhKu.jpeg
// @package mangakomi
// @type manga
// @webSite https://mangakomi.io
// ==/MiruExtension==

export default class extends Extension {
async req(url) {
return this.request(url, {
headers: {
"Miru-Url": await this.getSetting("mangakomi"),
},
});
}

async load() {
this.registerSetting({
title: "Base URL",
key: "mangakomi",
type: "input",
description: "Homepage URL for MangaKomi",
defaultValue: "https://mangakomi.io",
});

this.registerSetting({
title: "Reverse Order of Chapters",
key: "reverseChaptersOrder",
type: "toggle",
description: "Reverse the order of chapters in ascending order",
defaultValue: "true",
});
}

async latest(page) {
const res = await this.req(`/manga/page/${page}/?m_orderby=latest`);
const latest = await this.querySelectorAll(res, "div.row.row-eq-height > div.col-12.col-md-6");

let comic = [];
for (const element of latest) {
const html = await element.content;
const url = await this.getAttributeText(html, "h3 > a", "href");
const title = await this.querySelector(html, "h3 > a").text;
const cover = await this.querySelector(html, "img").getAttributeText("data-src");

comic.push({
title: title.trim(),
url,
cover,
});
}
return comic;
}

async search(kw) {
const kwstring = kw.replace(/ /g, "+");
const res = await this.req(`/?s=${kwstring}&post_type=wp-manga`);
const searchList = await this.querySelectorAll(res, "div.c-tabs-item > div.row.c-tabs-item__content");
const result = await Promise.all(
searchList.map(async (element) => {
const html = await element.content;
const url = await this.getAttributeText(html, "h3 > a", "href");
const title = await this.querySelector(html, "h3 > a").text;
const cover = await this.querySelector(html, "img").getAttributeText("data-src");

return {
title: title.trim(),
url,
cover,
};
})
);
return result;
}

async detail(url) {
const res = await this.request("", {
headers: {
"Miru-Url": url,
},
});

const title = await this.querySelector(res, "h1").text;
const cover = await this.querySelector(res, "div.summary_image > a > img.img-responsive.lazyload").getAttributeText("data-src");
const desc = await this.querySelector(res, "div.summary__content.show-more").text;

const epiList = await this.querySelectorAll(res, "ul.main.version-chap > li");
const episodes = await Promise.all(
epiList.map(async (element) => {
const html = await element.content;
const name = await this.querySelector(html, "a").text;
const url = await this.getAttributeText(html, "a", "href");
return {
name: name.trim(),
url,
};
})
);

if ((await this.getSetting("reverseChaptersOrder")) === "true") {
episodes.reverse();
}

return {
title: title.trim(),
cover,
desc: desc.trim(),
episodes: [
{
title: "Chapters",
urls: episodes,
},
],
};
}

async watch(url) {
const res = await this.request("", {
headers: {
"Miru-Url": url,
},
});

const images = await Promise.all(
(await this.querySelectorAll(res, "div.reading-content > div.page-break > img")).map(async (element) => {
const html = await element.content;
let dataSrc = await this.getAttributeText(html, "img", "data-src");
dataSrc = dataSrc.trim();
return dataSrc;
})
);

return {
urls: images,
};
}
}

0 comments on commit 06b1e3a

Please sign in to comment.