Skip to content

Commit

Permalink
Create airav.js
Browse files Browse the repository at this point in the history
  • Loading branch information
OshekharO authored Feb 19, 2024
1 parent 8b804a2 commit e3fb0b3
Showing 1 changed file with 78 additions and 0 deletions.
78 changes: 78 additions & 0 deletions repo/airav.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
// ==MiruExtension==
// @name AirWiki
// @version v0.0.1
// @author OshekharO
// @lang jp
// @license MIT
// @icon https://wiki-img.airav.wiki/storage/settings/September2019/hj8LddG9oFlmPe0YFkUd.png
// @package airav
// @type bangumi
// @webSite https://www.airav.wiki
// @nsfw true
// ==/MiruExtension==

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

async load() {
this.registerSetting({
title: "Airav",
key: "airav",
type: "input",
description: "Airav Domain",
defaultValue: "https://www.airav.wiki",
});
}

async latest(page) {
const res = await this.req(`/api/video/list?lang=en&lng=en&search=&page=${page}`);
return res.result.map((item) => ({
title: item.name != null ? item.name : "",
url: item.barcode,
cover: item.img_url != null ? item.img_url : "",
}));
}

async detail(url) {
const res = await this.req(`/api/video/barcode/${url}`);

return {
title: res.result.name != null ? res.result.name : "",
cover: res.result.img_url != null ? res.result.img_url : "",
desc: res.result.description != null ? res.result.description : "",
episodes: [
{
title: "Directory",
urls: [
{
name: res.result.name != null ? res.result.name : "",
url: res.result.video_url.url_hls_cdn != null ? res.result.video_url.url_hls_cdn : "",
},
],
},
],
};
}

async search(kw) {
const res = await this.req(`/api/video/list?search=${kw}&lng=en`);
return res.result.map((item) => ({
title: item.name != null ? item.name : "",
url: item.barcode,
cover: item.img_url != null ? item.img_url : "",
}));
}

async watch(url) {
return {
type: "hls",
url: url,
};
}
}

0 comments on commit e3fb0b3

Please sign in to comment.