-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from miru-project/main
Base up-to-date
- Loading branch information
Showing
7 changed files
with
278 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
// ==MiruExtension== | ||
// @name JavHD | ||
// @version v0.0.1 | ||
// @author OshekharO | ||
// @lang jp | ||
// @license MIT | ||
// @package javhd.today | ||
// @type bangumi | ||
// @icon https://javhd.today/android-icon-192x192.png | ||
// @webSite https://javhd.today | ||
// @nsfw true | ||
// ==/MiruExtension== | ||
|
||
export default class extends Extension { | ||
async latest() { | ||
const res = await this.request("/releaseday/"); | ||
const bsxList = await this.querySelectorAll(res, "div.video"); | ||
const novel = []; | ||
for (const element of bsxList) { | ||
const html = await element.content; | ||
const url = await this.getAttributeText(html, "a.thumbnail", "href"); | ||
const title = await this.querySelector(html, "span.video-title").text; | ||
const cover = await this.querySelector(html, "img").getAttributeText("src"); | ||
//console.log(title+cover+url) | ||
novel.push({ | ||
title, | ||
url: 'https://javhd.today' + url, | ||
cover, | ||
}); | ||
} | ||
return novel; | ||
} | ||
|
||
async search(kw) { | ||
const res = await this.request(`/search/video/?s=${kw}`); | ||
const bsxList = await this.querySelectorAll(res, "div.video"); | ||
const novel = []; | ||
|
||
for (const element of bsxList) { | ||
const html = await element.content; | ||
const url = await this.getAttributeText(html, "a.thumbnail", "href"); | ||
const title = await this.querySelector(html, "span.video-title").text; | ||
const cover = await this.querySelector(html, "img").getAttributeText("src"); | ||
novel.push({ | ||
title, | ||
url: 'https://javhd.today' + url, | ||
cover, | ||
}); | ||
} | ||
return novel; | ||
} | ||
|
||
async detail(url) { | ||
const res = await this.request("", { | ||
headers: { | ||
"Miru-Url": url, | ||
}, | ||
}); | ||
|
||
const title = await this.querySelector(res, "meta[property='og:title']").getAttributeText("content"); | ||
const cover = await this.querySelector(res, "meta[property='og:image']").getAttributeText("content"); | ||
const desc = await this.querySelector(res, "p.description").text; | ||
|
||
const urlPatterns = [ | ||
/https:\/\/minoplres\.[^\s'"]+/, | ||
/https:\/\/vidcloud\.[^\s'"]+/, | ||
/https:\/\/emturbovid\.[^\s'"]+/, | ||
]; | ||
|
||
let episodeUrl = ""; | ||
|
||
for (const pattern of urlPatterns) { | ||
const match = res.match(pattern); | ||
if (match) { | ||
episodeUrl = match[0]; | ||
break; | ||
} | ||
} | ||
|
||
function limitWords(text, maxWords) { | ||
const words = text.split(/\s+/); | ||
if (words.length > maxWords) { | ||
return words.slice(0, maxWords).join(" ") + " ..."; | ||
} | ||
return text; | ||
} | ||
|
||
return { | ||
title: limitWords(title.trim(), 10), | ||
cover, | ||
desc, | ||
episodes: [ | ||
{ | ||
title: "Directory", | ||
urls: [ | ||
{ | ||
name: limitWords(title.trim(), 10), | ||
url: episodeUrl, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
async watch(url) { | ||
const res = await this.request("", { | ||
headers: { | ||
"Miru-Url": url, | ||
}, | ||
}); | ||
|
||
let directUrl = ""; | ||
|
||
if (url.startsWith("https://minoplres")) { | ||
const dwishLink = res.match(/https:\/\/tukipasti\.[^\s'"]+/); | ||
|
||
const dwishLinkRes = await this.request("", { | ||
headers: { | ||
"Miru-Url": dwishLink, | ||
}, | ||
}); | ||
|
||
const directUrlMatch = dwishLinkRes.match(/(https:\/\/[^\s'"]*\.m3u8[^\s'"]*)/); | ||
directUrl = directUrlMatch ? directUrlMatch[0] : ""; | ||
|
||
} else if (url.startsWith("https://vidcloud")) { | ||
|
||
const directUrlMatch = res.match(/(https:\/\/[^\s'"]*\.m3u8[^\s'"]*)/); | ||
directUrl = directUrlMatch ? directUrlMatch[0] : ""; | ||
} else if (url.startsWith("https://emturbovid.com")) { | ||
|
||
const emturbovidRes = await this.request("", { | ||
headers: { | ||
"Miru-Url": url, | ||
"referer": "https://emturbovid.com/", | ||
"origin": "https://emturbovid.com", | ||
}, | ||
method: "Get", | ||
}); | ||
|
||
const directUrlMatch = emturbovidRes.match(/(https:\/\/[^\s'"]*\.m3u8[^\s'"]*)/); | ||
directUrl = directUrlMatch ? directUrlMatch[0] : ""; | ||
} | ||
|
||
return { | ||
type: "hls", | ||
url: directUrl || "", | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
// ==MiruExtension== | ||
// @name YuriNeko | ||
// @version v0.0.1 | ||
// @author OshekharO | ||
// @lang vi | ||
// @license MIT | ||
// @icon https://yurineko.net/img/logo-footer.png | ||
// @package yurineko.net | ||
// @type manga | ||
// @webSite https://api.yurineko.net | ||
// @nsfw false | ||
// ==/MiruExtension== | ||
|
||
export default class extends Extension { | ||
async req(url) { | ||
return this.request(url, { | ||
headers: { | ||
"Miru-Url": await this.getSetting("yurineko"), | ||
}, | ||
}); | ||
} | ||
|
||
async load() { | ||
this.registerSetting({ | ||
title: "YURINEKO API", | ||
key: "yurineko", | ||
type: "input", | ||
description: "YURINEKO API URL", | ||
defaultValue: "https://api.yurineko.net", | ||
}); | ||
} | ||
|
||
async latest(page) { | ||
const res = await this.req(`/lastest2?page=${page}`); | ||
return res.result.map((item) => ({ | ||
url: "https://yurineko.net/manga/" + item.id, | ||
title: item.originalName, | ||
cover: item.thumbnail, | ||
})); | ||
} | ||
|
||
async detail(url) { | ||
const mangaId = url.match(/(\d+)/)[1]; | ||
const res = await this.req(`/manga/${mangaId}`); | ||
|
||
return { | ||
title: res.originalName, | ||
cover: res.thumbnail, | ||
desc: res.description, | ||
episodes: [ | ||
{ | ||
title: "Chapters", | ||
urls: res.chapters.reverse().map((item) => ({ | ||
name: `${item.name}`, | ||
url: `${item.id}|${item.mangaID}`, | ||
})), | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
async search(kw) { | ||
const res = await this.req(`/search?query=${kw}`); | ||
return res.result.map((item) => ({ | ||
title: item.originalName, | ||
url: "https://yurineko.net/manga/" + item.id, | ||
cover: item.thumbnail, | ||
})); | ||
} | ||
|
||
async watch(url) { | ||
const [chap, manga] = url.split("|"); | ||
const res = await this.request(`/${manga}/${chap}`, { | ||
headers: { | ||
"Miru-Url": "https://yurineko.net/read", | ||
}, | ||
}); | ||
|
||
const jsonData = res.match(/<script id="__NEXT_DATA__" type="application\/json">(.*?)<\/script>/)[1]; | ||
const parsedData = JSON.parse(jsonData); | ||
const chapterData = parsedData.props.pageProps.chapterData; | ||
|
||
return { | ||
urls: chapterData.url.map((item) => item), | ||
}; | ||
} | ||
} |