Skip to content

Commit

Permalink
Merge pull request #135 from bethropolis/main
Browse files Browse the repository at this point in the history
add omegascans
  • Loading branch information
OshekharO authored Dec 16, 2023
2 parents b31d521 + d7e5154 commit c364640
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
13 changes: 13 additions & 0 deletions index.json
Original file line number Diff line number Diff line change
Expand Up @@ -615,6 +615,19 @@
"version": "v0.0.1",
"webSite": "https://nyaa.si"
},
{
"author": "bethro",
"icon": "https://omegascans.org/icon.png",
"lang": "en",
"license": "MIT",
"name": "Omegascans",
"nsfw": "true",
"package": "omegascans.org",
"type": "manga",
"url": "omegascans.org.js",
"version": "v0.0.1",
"webSite": "https://api.omegascans.org"
},
{
"author": "OshekharO",
"icon": "https://onejav.com/static/img/onejav.5468a5a7d373.png",
Expand Down
87 changes: 87 additions & 0 deletions repo/omegascans.org.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
// ==MiruExtension==
// @name Omegascans
// @version v0.0.1
// @author bethro
// @lang en
// @license MIT
// @icon https://omegascans.org/icon.png
// @package omegascans.org
// @type manga
// @webSite https://api.omegascans.org
// @nsfw true
// ==/MiruExtension==

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

async load() {
this.registerSetting({
title: "Omegascans URL",
key: "omegascans",
type: "input",
description: "api URL for Omegascans",
defaultValue: "https://api.omegascans.org",
});
}

async latest(page) {
const res = await this.request(
`/query?query_string=&series_status=All&order=desc&orderBy=total_views&series_type=Comic&page=${page}&perPage=22`
);
const latestList = res.data.map((item) => ({
title: item.title,
url: item.series_slug,
cover: item.thumbnail,
}));

return latestList;
}

async search(kw, page) {
const res = await this.request(
`/query?query_string=${encodeURIComponent(kw)}&page=${page}`
);

const searchList = res.data.map((item) => ({
title: item.title,
url: item.series_slug,
cover: item.thumbnail,
}));

return searchList;
}

async detail(url) {
const res = await this.request(`/series/${url}`);

const { title, thumbnail: cover, description: desc, seasons } = res;

const episodes = seasons.map(({ season_name: title, chapters }) => ({
title,
urls: chapters.map(({ chapter_name: name, chapter_slug: slug }) => ({
name,
url: `${url}/${slug}`,
})),
}));

return {
title,
cover,
desc,
episodes,
};
}

async watch(url) {
const res = await this.request("/chapter/" + url);
return {
urls: res.data,
};
}
}

0 comments on commit c364640

Please sign in to comment.