From 01ae2d1279e3fd47ce4e0fc0121ad3937ddf8397 Mon Sep 17 00:00:00 2001 From: appdevelpo <56633229+appdevelpo@users.noreply.github.com> Date: Mon, 9 Oct 2023 00:39:51 +0800 Subject: [PATCH 1/2] Create animepahe.ru.js can select resolution between 1080,720,480 --- repo/animepahe.ru.js | 107 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 repo/animepahe.ru.js diff --git a/repo/animepahe.ru.js b/repo/animepahe.ru.js new file mode 100644 index 0000000..2355ead --- /dev/null +++ b/repo/animepahe.ru.js @@ -0,0 +1,107 @@ +// ==MiruExtension== +// @name Animepahe +// @version v0.0.1 +// @author appdevelpo +// @lang en +// @license MIT +// @icon https://animepahe.ru/pikacon.ico +// @package animepahe.ru +// @type bangumi +// @webSite https://animepahe.ru +// @nsfw false +// ==/MiruExtension== + +export default class extends Extension { + async search(kw, page) { + const res = await this.request(`/api?m=search&q=${kw}`); + // console.log(res); + return res.data.map((item) => ({ + title: item.title, + url: item.session.toString(), + cover: item.poster, + })); + } + + async latest(page) { + const res = await this.request(`/api?m=airing&page=${page}`); + return res.data.map((item) => ({ + title: item.anime_title, + url: item.anime_session.toString(), + cover: item.snapshot, + })); + } + + async detail(url) { + const res = await this.request("", { + headers: { + "Miru-Url": `https://animepahe.ru/anime/${url}`, + }, + }); + const title = res.match(/(.+?)<\/span>/)[1]; + const cover = res.match(/(.+?)<\/div>/)[1]; + const epRes = await this.request(`/api?m=release&id=${url}`) + // console.log(title[1]); + const reverse_data = epRes.data.reverse(); + return { + title: title, + cover: cover, + desc: desc, + episodes: [ + { + title: "SubsPlease-360p", + urls: reverse_data.map((item) => ({ + name: `Episode ${item.episode}`, + url: `${url}/${item.session};0`,//url;quality + })), + }, + { + title: "SubsPlease-720p", + urls: reverse_data.map((item) => ({ + name: `Episode ${item.episode}`, + url: `${url}/${item.session};1`, + })), + }, + { + title: "SubsPlease-1080p", + urls: reverse_data.map((item) => ({ + name: `Episode ${item.episode}`, + url: `${url}/${item.session};2`, + })), + }, + ], + }; + } + + async watch(url) { + // console.log(url); + const url_split = url.split(';'); + const res = await this.request("",{ + headers:{ + "Miru-Url": `https://animepahe.ru/play/${url_split[0]}`, + } + }) + // console.log((/data-src="https:\/\/kwik.cx.+?"/g).exec(res)[parseInt(url_split[1])]); + console.log(res.match(/data-src="https:\/\/kwik.cx.+?"/g)) + const src_match = res.match(/data-src="https:\/\/kwik.cx.+?"/g)[parseInt(url_split[1])]; //480,720,1080 === [0],[1],[2] + console.log(src_match); + const src = src_match.match(/data-src="(.+?)"/)[1]; + console.log(src); + const hid_res = await this.request("",{ + headers:{ + "Miru-Url": src, + "Referer": "https://animepahe.com", + "user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/107.0.0.0 Safari/537.36 Edg/107.0.1418.56" + } + }) + const hid_script = hid_res.match(/eval\(f.+?\}\)\)/g)[1]; + const decode_script = eval(hid_script.match(/eval(.+)/)[1]); + //the obfuscated script look like eval(function(p,a,c,k,e,d){e=function(c){return(c Date: Sun, 8 Oct 2023 22:33:13 +0530 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A4=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/animepahe.ru.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/repo/animepahe.ru.js b/repo/animepahe.ru.js index 2355ead..1022f15 100644 --- a/repo/animepahe.ru.js +++ b/repo/animepahe.ru.js @@ -12,7 +12,7 @@ // ==/MiruExtension== export default class extends Extension { - async search(kw, page) { + async search(kw) { const res = await this.request(`/api?m=search&q=${kw}`); // console.log(res); return res.data.map((item) => ({ @@ -82,11 +82,11 @@ export default class extends Extension { } }) // console.log((/data-src="https:\/\/kwik.cx.+?"/g).exec(res)[parseInt(url_split[1])]); - console.log(res.match(/data-src="https:\/\/kwik.cx.+?"/g)) + // console.log(res.match(/data-src="https:\/\/kwik.cx.+?"/g)) const src_match = res.match(/data-src="https:\/\/kwik.cx.+?"/g)[parseInt(url_split[1])]; //480,720,1080 === [0],[1],[2] - console.log(src_match); + // console.log(src_match); const src = src_match.match(/data-src="(.+?)"/)[1]; - console.log(src); + // console.log(src); const hid_res = await this.request("",{ headers:{ "Miru-Url": src, @@ -96,7 +96,7 @@ export default class extends Extension { }) const hid_script = hid_res.match(/eval\(f.+?\}\)\)/g)[1]; const decode_script = eval(hid_script.match(/eval(.+)/)[1]); - //the obfuscated script look like eval(function(p,a,c,k,e,d){e=function(c){return(c