-
Notifications
You must be signed in to change notification settings - Fork 142
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 #134 from bachig26/main
[add] pornxp
- Loading branch information
Showing
2 changed files
with
102 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
// ==MiruExtension== | ||
// @name PornXP | ||
// @version v0.0.1 | ||
// @author bachig26 | ||
// @lang en | ||
// @license MIT | ||
// @package pornxp.com | ||
// @type bangumi | ||
// @icon https://www.pornxp.com/logo2.png | ||
// @webSite https://www.pornxp.com | ||
// @nsfw true | ||
// ==/MiruExtension== | ||
|
||
export default class extends Extension { | ||
async latest(page) { | ||
const res = await this.request("/released/?page={page}"); | ||
const bsxList = await this.querySelectorAll(res, "div.item_cont"); | ||
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, "div.item_title").text; | ||
const cover = await this.querySelector(html, "img").getAttributeText("data-src"); | ||
novel.push({ | ||
title, | ||
url: "https://www.pornxp.com" + url, | ||
cover: "https:" + cover, | ||
}); | ||
} | ||
return novel; | ||
} | ||
|
||
async search(kw) { | ||
const kwstring = kw.replace(/ /g, '+'); | ||
const res = await this.request(`/?q=${kwstring}`); | ||
const bsxList = await this.querySelectorAll(res, "div.item_cont"); | ||
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, "div.item_title").text; | ||
const cover = await this.querySelector(html, "img").getAttributeText("data-src"); | ||
novel.push({ | ||
title, | ||
url: "https://www.pornxp.com" + url, | ||
cover: "https:" + cover, | ||
}); | ||
} | ||
return novel; | ||
} | ||
|
||
async detail(url) { | ||
const res = await this.request("", { | ||
headers: { | ||
"Miru-Url": url, | ||
}, | ||
}); | ||
|
||
const title = await this.querySelector(res, "h1").text; | ||
const cover = await this.querySelector(res, "video").getAttributeText("poster"); | ||
const urlPatterns = [/\/\/[^\s'"]+\.(?:mp4|m3u8)/]; | ||
|
||
let episodeUrl = ""; | ||
|
||
for (const pattern of urlPatterns) { | ||
const match = res.match(pattern); | ||
if (match) { | ||
episodeUrl = match[0]; | ||
break; | ||
} | ||
} | ||
|
||
return { | ||
title: title.trim(), | ||
cover: "https:" + cover, | ||
episodes: [ | ||
{ | ||
title: "Directory", | ||
urls: [ | ||
{ | ||
name: title, | ||
url: "https:" + episodeUrl, | ||
}, | ||
], | ||
}, | ||
], | ||
}; | ||
} | ||
|
||
async watch(url) { | ||
return { | ||
type: "hls", | ||
url: url || "", | ||
}; | ||
} | ||
} |
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