diff --git a/javascript/anime/src/zh/mikan.js b/javascript/anime/src/zh/mikan.js index abbd893a..3fabbb92 100644 --- a/javascript/anime/src/zh/mikan.js +++ b/javascript/anime/src/zh/mikan.js @@ -3,11 +3,11 @@ const mangayomiSources = [{ "lang": "zh", "baseUrl": "https://mikanime.tv", "apiUrl": "", - "iconUrl": "https://mikanime.tv/images/mikan-pic.png", + "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.mikan.png", "typeSource": "torrent", "isManga": false, "isNsfw": false, - "version": "0.0.15", + "version": "0.0.2", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "anime/src/zh/mikan.js" @@ -30,9 +30,10 @@ class DefaultExtension extends MProvider { async getItems(url, cookies) { var res; - if (cookies) { + const identity = new SharedPreferences().get("cookies"); + if ((cookies) && (identity.length > 0)) { res = await new Client().get(this.source.baseUrl + url, { - Cookie: `.AspNetCore.Identity.Application=${new SharedPreferences().get("cookies")}` + Cookie: `.AspNetCore.Identity.Application=${identity}` }); } else { res = await new Client().get(this.source.baseUrl + url); @@ -127,7 +128,7 @@ class DefaultExtension extends MProvider { return [{ "key": "cookies", "editTextPreference": { - "title": "用户Cookies", + "title": "用户Cookies(在webview中登陆则可不设)", "summary": "用于读取用户订阅的Cookies(.AspNetCore.Identity.Application)", "value": "", "dialogTitle": "Cookies", diff --git a/javascript/anime/src/zh/yhdm.js b/javascript/anime/src/zh/yhdm.js index a6bf7f82..feade271 100644 --- a/javascript/anime/src/zh/yhdm.js +++ b/javascript/anime/src/zh/yhdm.js @@ -1,13 +1,13 @@ const mangayomiSources = [{ "name": "樱花动漫", "lang": "zh", - "baseUrl": "http://www.iyinghua.io", + "baseUrl": "http://www.iyinghua.com", "apiUrl": "", - "iconUrl": "http://www.iyinghua.io/js/20180601/favicon.ico", + "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.yhdm.png", "typeSource": "single", "isManga": false, "isNsfw": false, - "version": "0.0.15", + "version": "0.0.2", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "anime/src/zh/yhdm.js" @@ -51,12 +51,21 @@ class DefaultExtension extends MProvider { return String.fromCharCode.apply(null, charCodes); } + getBaseUrl() { + const preference = new SharedPreferences(); + var base_url = preference.get("domain_url"); + if (base_url.endsWith("/")) { + return base_url.slice(0, -1); + } + return base_url; + } + getHeaders(url) { throw new Error("getHeaders not implemented"); } async getItems(url, p, d) { - const res = await new Client().get(this.source.baseUrl + url); + const res = await new Client().get(this.getBaseUrl() + url); const doc = new Document(res.body); const items = []; const elements = doc.select(p); @@ -91,7 +100,7 @@ class DefaultExtension extends MProvider { } async getDetail(url) { - const res = await new Client().get(this.source.baseUrl + url); + const res = await new Client().get(this.getBaseUrl() + 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); @@ -119,7 +128,7 @@ class DefaultExtension extends MProvider { } async getVideoList(url) { - const res = await new Client().get(this.source.baseUrl + url); + const res = await new Client().get(this.getBaseUrl() + url); const doc = new Document(res.body); const video_url = this.stringUTF8(doc.selectFirst("div#playbox").attr("data-vid").split("$")[0], true); return [{ @@ -354,6 +363,16 @@ class DefaultExtension extends MProvider { } getSourcePreferences() { - throw new Error("getSourcePreferences not implemented"); + return [{ + "key": "domain_url", + "editTextPreference": { + "title": "Url", + "summary": "樱花动漫网址", + "value": "http://www.iyinghua.com", + "dialogTitle": "URL", + "dialogMessage": "", + } + } + ]; } } \ No newline at end of file diff --git a/javascript/icon/zh.77mh.png b/javascript/icon/zh.77mh.png new file mode 100644 index 00000000..8642d00c Binary files /dev/null and b/javascript/icon/zh.77mh.png differ diff --git a/javascript/icon/zh.copymanga.png b/javascript/icon/zh.copymanga.png new file mode 100644 index 00000000..d2c4ba8e Binary files /dev/null and b/javascript/icon/zh.copymanga.png differ diff --git a/javascript/icon/zh.dmzj.png b/javascript/icon/zh.dmzj.png new file mode 100644 index 00000000..0c23fdef Binary files /dev/null and b/javascript/icon/zh.dmzj.png differ diff --git a/javascript/icon/zh.manhuadb.png b/javascript/icon/zh.manhuadb.png deleted file mode 100644 index 3c4a76b7..00000000 Binary files a/javascript/icon/zh.manhuadb.png and /dev/null differ diff --git a/javascript/icon/zh.mikan.png b/javascript/icon/zh.mikan.png new file mode 100644 index 00000000..3e80636a Binary files /dev/null and b/javascript/icon/zh.mikan.png differ diff --git a/javascript/icon/zh.yhdm.png b/javascript/icon/zh.yhdm.png new file mode 100644 index 00000000..c4bfec3e Binary files /dev/null and b/javascript/icon/zh.yhdm.png differ diff --git a/javascript/manga/src/zh/77mh.js b/javascript/manga/src/zh/77mh.js index 78417889..14c31c12 100644 --- a/javascript/manga/src/zh/77mh.js +++ b/javascript/manga/src/zh/77mh.js @@ -3,7 +3,7 @@ const mangayomiSources = [{ "lang": "zh", "baseUrl": "https://www.77mh.nl", "apiUrl": "", - "iconUrl": "https://www.77mh.nl/favicon.ico", + "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.77mh.png", "typeSource": "single", "isManga": true, "isNsfw": false, diff --git a/javascript/manga/src/zh/copymanga.js b/javascript/manga/src/zh/copymanga.js index 9278cad6..c100ba9b 100644 --- a/javascript/manga/src/zh/copymanga.js +++ b/javascript/manga/src/zh/copymanga.js @@ -3,11 +3,11 @@ const mangayomiSources = [{ "lang": "zh", "baseUrl": "https://www.mangacopy.com", "apiUrl": "https://api.mangacopy.com", - "iconUrl": "https://hi77-overseas.mangafuna.xyz/static/free.ico", + "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.copymanga.png", "typeSource": "single", "isManga": true, "isNsfw": false, - "version": "0.0.2", + "version": "0.0.25", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "manga/src/zh/copymanga.js" @@ -100,6 +100,21 @@ const mangayomiSources = [{ Referer: this.source.baseUrl }; } + + reqHeaders() { + const date = new Date(); + const year = date.getFullYear(); + const month = String(date.getMonth() + 1).padStart(2, '0'); + const day = String(date.getDate()).padStart(2, '0'); + return { + 'User-Agent': 'duoTuoCartoon/3.2.4 (iPhone; iOS 18.0.1; Scale/3.00) iDOKit/1.0.0 RSSX/1.0.0', + 'version': `${year}.${month}.${day}`, + 'region': '0', + 'webp': '0', + "platform": "1", + "Referer": "https://www.copymanga.com/" + } + } async getManga(url) { const res = await new Client().get(this.source.apiUrl + url); @@ -128,14 +143,8 @@ const mangayomiSources = [{ async search(query, page, filters) { if (query != "") { - const res = await new Client().get(this.source.apiUrl + `/api/v3/search/comic?platform=1&q=${query}&limit=16&offset=${(page -1)*16}&q_type=&_update=true`, { - "webp": '1', - "region": '1', - "platform": '1', - "version": '2022.10.20', - "accept": 'application/json', - 'content-encoding': 'gzip, compress, br' - }); + const res = await new Client().get(this.source.apiUrl + `/api/v3/search/comic?platform=1&q=${query}&limit=16&offset=${(page -1)*16}&q_type=&_update=true`, + this.reqHeaders()); const datas = JSON.parse(res.body)["results"]["list"]; const manga = []; for (const data of datas) { @@ -167,7 +176,7 @@ const mangayomiSources = [{ async getDetail(url) { url = url.substringAfter("/comic/"); - const res = await new Client().get(this.source.apiUrl + `/api/v3/comic2/${url}`); + const res = await new Client().get(this.source.apiUrl + `/api/v3/comic2/${url}`, this.reqHeaders()); const data = JSON.parse(res.body)["results"]["comic"]; const title = this.stringUTF8(data["name"]); const cover = data["cover"]; diff --git a/javascript/manga/src/zh/dmzj.js b/javascript/manga/src/zh/dmzj.js index 9c490fd4..d8ebf4af 100644 --- a/javascript/manga/src/zh/dmzj.js +++ b/javascript/manga/src/zh/dmzj.js @@ -3,11 +3,11 @@ const mangayomiSources = [{ "lang": "zh", "baseUrl": "https://www.dmzj.com", "apiUrl": "", - "iconUrl": "https://www.dmzj.com/_nuxt/logo_dmzj.1c94014a.png", + "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.dmzj.png", "typeSource": "single", "isManga": true, "isNsfw": false, - "version": "0.0.25", + "version": "0.0.3", "dateFormat": "", "dateFormatLocale": "", "pkgPath": "manga/src/zh/dmzj.js" diff --git a/javascript/manga/src/zh/manhuadb.js b/javascript/manga/src/zh/manhuadb.js deleted file mode 100644 index bc270e02..00000000 --- a/javascript/manga/src/zh/manhuadb.js +++ /dev/null @@ -1,669 +0,0 @@ -const mangayomiSources = [{ - "name": "漫画DB", - "lang": "zh", - "baseUrl": "https://www.manhuadb.com", - "apiUrl": "", - "iconUrl": "https://raw.githubusercontent.com/kodjodevf/mangayomi-extensions/main/javascript/icon/zh.manhuadb.png", - "typeSource": "single", - "isManga": true, - "isNsfw": false, - "version": "0.0.25", - "dateFormat": "", - "dateFormatLocale": "", - "pkgPath": "manga/src/zh/manhuadb.js" -}]; - -class DefaultExtension extends MProvider { - base64decode(str) { - var base64DecodeChars = new Array(-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, -1, -1, -1, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1, -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1); - var c1, c2, c3, c4; - var i, len, out; - len = str.length; - i = 0; - out = ""; - while (i < len) { - do { - c1 = base64DecodeChars[str.charCodeAt(i++) & 0xff] - } while (i < len && c1 == -1); - if (c1 == -1) - break; - do { - c2 = base64DecodeChars[str.charCodeAt(i++) & 0xff] - } while (i < len && c2 == -1); - if (c2 == -1) - break; - out += String.fromCharCode((c1 << 2) | ((c2 & 0x30) >> 4)); - do { - c3 = str.charCodeAt(i++) & 0xff; - if (c3 == 61) - return out; - c3 = base64DecodeChars[c3] - } while (i < len && c3 == -1); - if (c3 == -1) - break; - out += String.fromCharCode(((c2 & 0XF) << 4) | ((c3 & 0x3C) >> 2)); - do { - c4 = str.charCodeAt(i++) & 0xff; - if (c4 == 61) - return out; - c4 = base64DecodeChars[c4] - } while (i < len && c4 == -1); - if (c4 == -1) - break; - out += String.fromCharCode(((c3 & 0x03) << 6) | c4) - } - return out - } - - coverUrlConvert(cover_url) { - if (cover_url.search("com") == -1) { - return this.source.baseUrl + cover_url; - } - return cover_url; - } - - async getMangas(url, search) { - const res = await new Client().get(this.source.baseUrl + url); - const doc = new Document(res.body); - var str; - if (search) { - str = "div.comicbook-index"; - } else { - str = "div.media"; - } - const items = doc.select(str); - const mangas = []; - for (const item of items) { - const cover = this.coverUrlConvert(item.selectFirst("a.d-block img").attr("src")); - var title; - if (search) { - title = item.selectFirst("a.d-block").attr("title"); - } else { - title = item.selectFirst("a.d-block img").attr("alt"); - title = title.replace("的封面图", ""); - } - const url = item.selectFirst("a.d-block").attr("href"); - mangas.push({ - name: title, - link: url, - imageUrl: cover - }); - } - return { - list: mangas, - hasNextPage: true - } - } - - async getPopular(page) { - const res = await new Client().get(this.source.baseUrl); - const doc = new Document(res.body); - const items = doc.select("div.comicbook-index"); - var mangas = []; - for (let item of items) { - const cover = this.coverUrlConvert(item.selectFirst("a img").attr("src")); - const title = item.selectFirst("a img").attr("alt"); - const url = item.selectFirst("a").attr("href") - mangas.push({ - name: title.replace("封面", ""), - link: url, - imageUrl: cover - }); - } - return { - list: mangas, - hasNextPage: false - }; - } - - async getLatestUpdates(page) { - return await this.getMangas(`/manhua/list-page-${page}.html`, false); - } - - async search(query, page, filters) { - if (query == "") { - var locations, readers, status, categories; - for (const filter of filters) { - if (filter["type"] == "locations") { - locations = filter["values"][filter["state"]]["value"]; - } else if (filter["type"] == "readers") { - readers = filter["values"][filter["state"]]["value"]; - } else if (filter["type"] == "status") { - status = filter["values"][filter["state"]]["value"]; - } else if (filter["type"] == "categories") { - categories = filter["values"][filter["state"]]["value"]; - } - } - const url = `/manhua/list${locations}${readers}${status}${categories}-page-${page}.html`; - return await this.getMangas(url.replaceAll("all", ""), false); - } else { - return await this.getMangas(`/search?q=${query}&p=${page}`, true); - } - } - - async getDetail(url) { - const res = await new Client().get(this.source.baseUrl + url); - const doc = new Document(res.body); - const title = doc.selectFirst("h1.comic-title").text; - const cover = this.coverUrlConvert(doc.selectFirst("td.comic-cover img").attr("src")); - const desc = doc.selectFirst("p.comic_story").text; - const author = doc.selectFirst("ul.creators a").text; - var tags = doc.select("ul.tags a").map(e => e.text); - var status = 5; - if (tags[0] == "已完结") { - status = 1; - tags.shift(); - } - if (tags[0] == "连载中") { - status = 0; - tags.shift(); - } - const items = doc.select("ol.links-of-books"); - const episodes = []; - const ep_names = doc.select("span.h3"); - const ep_titles = []; - for (const ep_name of ep_names) { - ep_titles.push(ep_name.text); - } - var index = 0; - for (const lists of items) { - const chapters = lists.select("li"); - for (const chapter of chapters) { - const name = chapter.selectFirst("a").attr("title"); - const url = chapter.selectFirst("a").attr("href"); - episodes.push({ - name: `[[${ep_titles[index]}]]${name}`, - url: url - }); - } - index = index + 1; - } - episodes.reverse(); - return { - name: title, - imageUrl: cover, - description: desc, - episodes: episodes, - genre: tags, - author: author, - status: status - }; - } - - async getPageList(url) { - const res = await new Client().get(this.source.baseUrl + url); - const html = res.body; - const doc = new Document(html); - const urls = []; - var script_str = html.match(/