From 8691e9fa247fcec063080a9d30e4fcc8ff15d415 Mon Sep 17 00:00:00 2001 From: Bharathi <96393348+bachig26@users.noreply.github.com> Date: Mon, 15 Jan 2024 15:14:08 +0100 Subject: [PATCH] Add: MkvDrama --- repo/stream.mkvdrama.org.js | 128 ++++++++++++++++++++++++++++++++++++ 1 file changed, 128 insertions(+) create mode 100644 repo/stream.mkvdrama.org.js diff --git a/repo/stream.mkvdrama.org.js b/repo/stream.mkvdrama.org.js new file mode 100644 index 0000000..87a98ca --- /dev/null +++ b/repo/stream.mkvdrama.org.js @@ -0,0 +1,128 @@ +// ==MiruExtension== +// @name MkvDrama +// @version v0.0.1 +// @author bachig26 +// @lang en +// @license MIT +// @package stream.mkvdrama.org +// @type bangumi +// @icon https://mkvdrama.org/wp-content/uploads/2023/03/474a064744e1d9fe02e1124b2b071c70.png +// @webSite https://stream.mkvdrama.org +// @nsfw false +// ==/MiruExtension== + +export default class extends Extension { + async latest(page) { + const res = await this.request(`/?page=${page}`); + const bsxList = await this.querySelectorAll(res, "div.drama-item"); + const novel = []; + for (const element of bsxList) { + const html = await element.content; + const url = await this.getAttributeText(html, "a", "href"); + const title = await this.querySelector(html, "b").text; + const cover = await this.querySelector(html, "img").getAttributeText("src"); + //console.log(title+cover+url) + novel.push({ + title: title.trim(), + url: "https://stream.mkvdrama.org" + url, + cover, + }); + } + return novel; + } + + async search(kw) { + const res = await this.request(`/search.html?keyword=${kw}`); + const bsxList = await this.querySelectorAll(res, "div.drama-item"); + const novel = []; + + for (const element of bsxList) { + const html = await element.content; + const url = await this.getAttributeText(html, "a", "href"); + const title = await this.querySelector(html, "b").text; + const cover = await this.querySelector(html, "img").getAttributeText("src"); + novel.push({ + title: title.trim(), + url: "https://stream.mkvdrama.org" + url, + cover, + }); + } + return novel; + } + + async detail(url) { + const res = await this.request('', { + headers: { + "Miru-Url": url, + }, + }); + + const title = await this.querySelector(res, "span.date").text; + const cover = await this.querySelector(res, "meta[property='og:image']").getAttributeText("content"); + const desc = await this.querySelector(res, "div.content-more-js > p").text; + + const episodes = []; + const epiList = await this.querySelectorAll(res, "div.episode-grid > article"); + + for (const element of epiList) { + const html = await element.content; + const name = await this.querySelector(html, "h2.episode-title").text; + console.log(name); + const url = await this.getAttributeText(html, "a", "href"); + episodes.push({ + name: name.trim(), + url, + }); + } + + return { + title: title.trim(), + cover, + desc: desc.trim(), + episodes: [ + { + title: "Directory", + urls: episodes.reverse(), + }, + ], + }; + } + + async watch(url) { + const res = await this.request('', { +      headers: { +        "Miru-Url": `https://stream.mkvdrama.org${url}`, +      }, +    }); + const urlPatterns = [/