From b20401f4a193b12a358eb00d73007da8acd763f2 Mon Sep 17 00:00:00 2001 From: ftbom Date: Mon, 13 May 2024 07:46:42 +0800 Subject: [PATCH] add mikan and yhdm --- javascript/anime/src/zh/mikan.js | 138 ++++++++++++ javascript/anime/src/zh/yhdm.js | 356 +++++++++++++++++++++++++++++++ javascript/manga/src/zh/dmzj.js | 6 +- 3 files changed, 497 insertions(+), 3 deletions(-) create mode 100644 javascript/anime/src/zh/mikan.js create mode 100644 javascript/anime/src/zh/yhdm.js diff --git a/javascript/anime/src/zh/mikan.js b/javascript/anime/src/zh/mikan.js new file mode 100644 index 00000000..7f249283 --- /dev/null +++ b/javascript/anime/src/zh/mikan.js @@ -0,0 +1,138 @@ +const mangayomiSources = [{ + "name": "蜜柑计划", + "lang": "zh", + "baseUrl": "https://mikanime.tv", + "apiUrl": "", + "iconUrl": "https://mikanime.me/images/mikan-pic.png", + "typeSource": "torrent", + "isManga": false, + "isNsfw": false, + "version": "0.0.1", + "dateFormat": "", + "dateFormatLocale": "", + "pkgPath": "anime/src/zh/mikan.js" +}]; + +class DefaultExtension extends MProvider { + dateStringToTimestamp(dateString) { + var parts = dateString.split('/'); + var year = parseInt(parts[2]); + var month = parseInt(parts[0]) - 1; + var day = parseInt(parts[1]); + var date = new Date(year, month, day); + var timestamp = date.getTime(); + return timestamp; + } + + getHeaders(url) { + throw new Error("getHeaders not implemented"); + } + + async getItems(url, cookies) { + var res; + if (cookies) { + res = await new Client().get(this.source.baseUrl + url, { + Cookie: `.AspNetCore.Identity.Application=${new SharedPreferences().get("cookies")}` + }); + } else { + res = await new Client().get(this.source.baseUrl + url); + } + const doc = new Document(res.body); + const items = []; + const elements = doc.select("div.m-week-square"); + for (const element of elements) { + const url = element.selectFirst("a").attr("href"); + if (url == "javascript:void(0);") { + continue; + } + const title = element.selectFirst("a").attr("title"); + const cover = this.source.baseUrl + element.selectFirst("img").attr("data-src"); + items.push({ + name: title, + imageUrl: cover, + link: url + }); + } + return { + list: items, + hasNextPage: false + }; + } + + async getPopular(page) { + return await this.getItems("/Home/MyBangumi", true); + } + + async getLatestUpdates(page) { + return await this.getItems("", false); + } + + async search(query, page, filters) { + const res = await new Client().get(this.source.baseUrl + `/Home/Search?searchstr=${query}`); + const doc = new Document(res.body); + const items = []; + const elements = doc.select("div.central-container ul.list-inline li"); + for (const element of elements) { + const title = element.selectFirst("div.an-text").text; + const cover = this.source.baseUrl + element.selectFirst("span").attr("data-src"); + const url = element.selectFirst("a").attr("href"); + items.push({ + name: title, + imageUrl: cover, + link: url + }); + } + return { + list: items, + hasNextPage: false + }; + } + + async getDetail(url) { + const res = await new Client().get(this.source.baseUrl + url); + const doc = new Document(res.body); + const cover = this.source.baseUrl + doc.selectFirst("div.content img").attr("src"); + const title = doc.selectFirst("p.title").text; + const desc = doc.selectFirst("div.info").text; + const eps = []; + const lists = doc.select("div.m-bangumi-list-content"); + for (const list of lists) { + //const header = list.selectFirst("span.title").text; + for (const item of list.select("div.m-bangumi-item")) { + const title = item.selectFirst("div.text").text; + const url = this.source.baseUrl + item.selectFirst("div.right a").attr("href"); + const date = this.dateStringToTimestamp(item.selectFirst("div.date").text.split(" ")[0]); + eps.push({ + name: title, + url: url, + dateUpload: date.toString() + }); + } + } + eps.reverse(); + return { + name: title, + imageUrl: cover, + description: desc, + episodes: eps + }; + } + + + getFilterList() { + throw new Error("getFilterList not implemented"); + } + + getSourcePreferences() { + return [{ + "key": "cookies", + "editTextPreference": { + "title": "用户Cookies", + "summary": "用于读取用户订阅的Cookies(.AspNetCore.Identity.Application)", + "value": "", + "dialogTitle": "Cookies", + "dialogMessage": "", + } + }]; + } +} diff --git a/javascript/anime/src/zh/yhdm.js b/javascript/anime/src/zh/yhdm.js new file mode 100644 index 00000000..dda5d635 --- /dev/null +++ b/javascript/anime/src/zh/yhdm.js @@ -0,0 +1,356 @@ +const mangayomiSources = [{ + "name": "樱花动漫", + "lang": "zh", + "baseUrl": "http://www.iyinghua.io", + "apiUrl": "", + "iconUrl": "http://www.iyinghua.io/js/20180601/favicon.ico", + "typeSource": "single", + "isManga": false, + "isNsfw": false, + "version": "0.0.1", + "dateFormat": "", + "dateFormatLocale": "", + "pkgPath": "anime/src/zh/yhdm.js" +}]; + +class DefaultExtension extends MProvider { + stringUTF8(text, d) { + if (!d) { + return text; + } + var bytes = []; + for (var i = 0; i < text.length; i++) { + bytes.push(text.charCodeAt(i)); + } + var charCodes = []; + var i = 0; + while (i < bytes.length) { + var byte1 = bytes[i]; + var charCode; + if (byte1 < 0x80) { + charCode = byte1; + i += 1; + } else if (byte1 < 0xE0) { + var byte2 = bytes[i + 1]; + charCode = ((byte1 & 0x1F) << 6) | (byte2 & 0x3F); + i += 2; + } else if (byte1 < 0xF0) { + var byte2 = bytes[i + 1]; + var byte3 = bytes[i + 2]; + charCode = ((byte1 & 0x0F) << 12) | ((byte2 & 0x3F) << 6) | (byte3 & 0x3F); + i += 3; + } else { + var byte2 = bytes[i + 1]; + var byte3 = bytes[i + 2]; + var byte4 = bytes[i + 3]; + charCode = ((byte1 & 0x07) << 18) | ((byte2 & 0x3F) << 12) | ((byte3 & 0x3F) << 6) | (byte4 & 0x3F); + i += 4; + } + charCodes.push(charCode); + } + return String.fromCharCode.apply(null, charCodes); + } + + getHeaders(url) { + throw new Error("getHeaders not implemented"); + } + + async getItems(url, p, d) { + const res = await new Client().get(this.source.baseUrl + url); + const doc = new Document(res.body); + const items = []; + const elements = doc.select(p); + for (const element of elements) { + items.push({ + name: this.stringUTF8(element.selectFirst("img").attr("alt"), d), + imageUrl: element.selectFirst("img").attr("src"), + link: element.selectFirst("a").attr("href") + }); + } + return { + list: items, + hasNextPage: true + }; + } + + async getPopular(page) { + const results = await this.getItems("", "div.img li", true); + results["hasNextPage"] = false; + return results; + } + + async getLatestUpdates(page) { + return await this.getItems(`/${new Date().getFullYear()}/${(page == 1)? "":page.toString()+".html"}`, "div.lpic li", true); + } + + async search(query, page, filters) { + if (query) { + return await this.getItems(`/search/${query}/?page=${page}`, "div.lpic li", false); + } + return await this.getItems(filters[0]["values"][filters[0]["state"]]["value"] + ((page == 1) ? "" : page.toString() + ".html"), "div.lpic li", true); + } + + async getDetail(url) { + const res = await new Client().get(this.source.baseUrl + url); + const doc = new Document(res.body); + const cover = doc.selectFirst("div.thumb img").attr("src"); + const title = this.stringUTF8(doc.selectFirst("div.rate h1").text, true); + const genre = doc.select("div.sinfo a").map(e => this.stringUTF8(e.text, true)); + genre.splice(-1); + const desc = this.stringUTF8(doc.selectFirst("div.info").text, true); + const eps = []; + const elements = doc.select("div.movurl a"); + for (const element of elements) { + eps.push({ + name: this.stringUTF8(element.text, true), + url: element.attr("href") + }); + } + return { + name: title, + imageUrl: cover, + description: desc, + genre: genre, + episodes: eps + }; + } + + async getVideoList(url) { + const res = await new Client().get(this.source.baseUrl + url); + const doc = new Document(res.body); + const video_url = this.stringUTF8(doc.selectFirst("div#playbox").attr("data-vid").split("$")[0], true); + return [{ + url: video_url, + originalUrl: video_url, + quality: "Origin" + }]; + } + + getFilterList() { + return [{ + type: "Select", + type_name: "SelectFilter", + name: "分类", + values: [{ + name: "2024", + value: "/2024/", + type_name: "SelectOption" + }, + { + name: "2023", + value: "/2023/", + type_name: "SelectOption" + }, + { + name: "2022", + value: "/2022/", + type_name: "SelectOption" + }, + { + name: "2021", + value: "/2021/", + type_name: "SelectOption" + }, + { + name: "2020", + value: "/2020/", + type_name: "SelectOption" + }, + { + name: "2019", + value: "/2019/", + type_name: "SelectOption" + }, + { + name: "2018", + value: "/2018/", + type_name: "SelectOption" + }, + { + name: "2017", + value: "/2017/", + type_name: "SelectOption" + }, + { + name: "2016", + value: "/2016/", + type_name: "SelectOption" + }, + { + name: "2015", + value: "/2015/", + type_name: "SelectOption" + }, + { + name: "日本", + value: "/japan/", + type_name: "SelectOption" + }, + { + name: "大陆", + value: "/china/", + type_name: "SelectOption" + }, + { + name: "美国", + value: "/american/", + type_name: "SelectOption" + }, + { + name: "英国", + value: "/england/", + type_name: "SelectOption" + }, + { + name: "韩国", + value: "/korea/", + type_name: "SelectOption" + }, + { + name: "日语", + value: "/29/", + type_name: "SelectOption" + }, + { + name: "国语", + value: "/30/", + type_name: "SelectOption" + }, + { + name: "粤语", + value: "/31/", + type_name: "SelectOption" + }, + { + name: "英语", + value: "/32/", + type_name: "SelectOption" + }, + { + name: "韩语", + value: "/33/", + type_name: "SelectOption" + }, + { + name: "方言", + value: "/34/", + type_name: "SelectOption" + }, + { + name: "热血", + value: "/66/", + type_name: "SelectOption" + }, + { + name: "格斗", + value: "/64/", + type_name: "SelectOption" + }, + { + name: "恋爱", + value: "/91/", + type_name: "SelectOption" + }, + { + name: "校园", + value: "/70/", + type_name: "SelectOption" + }, + { + name: "搞笑", + value: "/67/", + type_name: "SelectOption" + }, + { + name: "LOLI", + value: "/111/", + type_name: "SelectOption" + }, + { + name: "神魔", + value: "/83/", + type_name: "SelectOption" + }, + { + name: "机战", + value: "/81/", + type_name: "SelectOption" + }, + { + name: "科幻", + value: "/75/", + type_name: "SelectOption" + }, + { + name: "真人", + value: "/74/", + type_name: "SelectOption" + }, + { + name: "青春", + value: "/84/", + type_name: "SelectOption" + }, + { + name: "魔法", + value: "/73/", + type_name: "SelectOption" + }, + { + name: "美少女", + value: "/72/", + type_name: "SelectOption" + }, + { + name: "神话", + value: "/102/", + type_name: "SelectOption" + }, + { + name: "冒险", + value: "/61/", + type_name: "SelectOption" + }, + { + name: "运动", + value: "/69/", + type_name: "SelectOption" + }, + { + name: "竞技", + value: "/62/", + type_name: "SelectOption" + }, + { + name: "童话", + value: "/103/", + type_name: "SelectOption" + }, + { + name: "励志", + value: "/85/", + type_name: "SelectOption" + }, + { + name: "后宫", + value: "/99/", + type_name: "SelectOption" + }, + { + name: "战争", + value: "/80/", + type_name: "SelectOption" + }, + { + name: "吸血鬼", + value: "/119/", + type_name: "SelectOption" + } + ] + }]; + } + + getSourcePreferences() { + throw new Error("getSourcePreferences not implemented"); + } +} \ No newline at end of file diff --git a/javascript/manga/src/zh/dmzj.js b/javascript/manga/src/zh/dmzj.js index 16fd2517..8c9f08b6 100644 --- a/javascript/manga/src/zh/dmzj.js +++ b/javascript/manga/src/zh/dmzj.js @@ -7,7 +7,7 @@ const mangayomiSources = [{ "typeSource": "single", "isManga": true, "isNsfw": false, - "version": "0.0.15", + "version": "0.0.2", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "manga/src/zh/dmzj.js" @@ -96,7 +96,7 @@ const mangayomiSources = [{ chapters.push({ name: `[[${chlist["title"]}]]` + ch["chapter_title"], url: datas["data"]["comicInfo"]["id"].toString() + "|" + ch["chapter_id"].toString(), - dateUpload: ch["updatetime"].toString() + dateUpload: ch["updatetime"].toString() + "000" }); } } @@ -109,7 +109,7 @@ const mangayomiSources = [{ description: desc, episodes: chapters, status: status, - link: this.source.baseUrl + "/info/" + url + link: "/info/" + url }; }