Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add omegascans #135

Merged
merged 2 commits into from
Dec 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
}
}