mirror of
https://github.com/venera-app/venera-configs.git
synced 2025-09-27 16:37:23 +00:00
Compare commits
13 Commits
170eb738b9
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
603fefe9be | ||
![]() |
cd941b92ef | ||
62fbe9294b | |||
91823846a0 | |||
ef87d90e89 | |||
![]() |
a991dac6d6 | ||
![]() |
c9fdc8367a | ||
![]() |
aafc7078ba | ||
![]() |
edebc0c430 | ||
![]() |
b6448c2055 | ||
![]() |
ca2f626483 | ||
![]() |
8a26cff469 | ||
![]() |
c281495cee |
@@ -1,4 +1,19 @@
|
||||
/** @type {import('./_venera_.js')} */
|
||||
|
||||
/**
|
||||
* @typedef {Object} PageJumpTarget
|
||||
* @Property {string} page - The page name (search, category)
|
||||
* @Property {Object} attributes - The attributes of the page
|
||||
*
|
||||
* @example
|
||||
* {
|
||||
* page: "search",
|
||||
* attributes: {
|
||||
* keyword: "example",
|
||||
* },
|
||||
* }
|
||||
*/
|
||||
|
||||
class NewComicSource extends ComicSource {
|
||||
// Note: The fields which are marked as [Optional] should be removed if not used
|
||||
|
||||
@@ -256,20 +271,42 @@ class NewComicSource extends ComicSource {
|
||||
```
|
||||
*/
|
||||
},
|
||||
// provide options for category comic loading
|
||||
// [Optional] provide options for category comic loading
|
||||
optionList: [
|
||||
{
|
||||
// [Optional] The label will not be displayed if it is empty.
|
||||
label: "",
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
"newToOld-New to Old",
|
||||
"oldToNew-Old to New"
|
||||
],
|
||||
// [Optional] {string[]} - show this option only when the value not in the list
|
||||
// [Optional] {string[]} - show this option only when the category not in the list
|
||||
notShowWhen: null,
|
||||
// [Optional] {string[]} - show this option only when the value in the list
|
||||
// [Optional] {string[]} - show this option only when the category in the list
|
||||
showWhen: null
|
||||
}
|
||||
],
|
||||
/**
|
||||
* [Optional] load options dynamically. If `optionList` is provided, this will be ignored.
|
||||
* @since 1.5.0
|
||||
* @param category {string}
|
||||
* @param param {string?}
|
||||
* @return {Promise<{options: string[], label?: string}[]>} - return a list of option group, each group contains a list of options
|
||||
*/
|
||||
optionLoader: async (category, param) => {
|
||||
return [
|
||||
{
|
||||
// [Optional] The label will not be displayed if it is empty.
|
||||
label: "",
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
"newToOld-New to Old",
|
||||
"oldToNew-Old to New"
|
||||
],
|
||||
}
|
||||
]
|
||||
},
|
||||
ranking: {
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
|
71
_venera_.js
71
_venera_.js
@@ -4,6 +4,18 @@ Venera JavaScript Library
|
||||
This library provides a set of APIs for interacting with the Venera app.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @function sendMessage
|
||||
* @global
|
||||
* @param {Object} message
|
||||
* @returns {any}
|
||||
*/
|
||||
|
||||
/**
|
||||
* Set a timeout to execute a callback function after a specified delay.
|
||||
* @param callback {Function}
|
||||
* @param delay {number} - delay in milliseconds
|
||||
*/
|
||||
function setTimeout(callback, delay) {
|
||||
sendMessage({
|
||||
method: 'delay',
|
||||
@@ -42,8 +54,6 @@ let Convert = {
|
||||
/**
|
||||
* @param str {string}
|
||||
* @returns {ArrayBuffer}
|
||||
*
|
||||
* @since 1.4.3
|
||||
*/
|
||||
encodeGbk: (str) => {
|
||||
return sendMessage({
|
||||
@@ -57,8 +67,6 @@ let Convert = {
|
||||
/**
|
||||
* @param value {ArrayBuffer}
|
||||
* @returns {string}
|
||||
*
|
||||
* @since 1.4.3
|
||||
*/
|
||||
decodeGbk: (value) => {
|
||||
return sendMessage({
|
||||
@@ -1042,20 +1050,6 @@ function ImageLoadingConfig({url, method, data, headers, onResponse, modifyImage
|
||||
this.onLoadFailed = onLoadFailed;
|
||||
}
|
||||
|
||||
/**
|
||||
* @typedef {Object} PageJumpTarget
|
||||
* @Property {string} page - The page name (search, category)
|
||||
* @Property {Object} attributes - The attributes of the page
|
||||
*
|
||||
* @example
|
||||
* {
|
||||
* page: "search",
|
||||
* attributes: {
|
||||
* keyword: "example",
|
||||
* },
|
||||
* }
|
||||
*/
|
||||
|
||||
class ComicSource {
|
||||
name = ""
|
||||
|
||||
@@ -1404,3 +1398,44 @@ let APP = {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set clipboard text
|
||||
* @param text {string}
|
||||
* @returns {Promise<void>}
|
||||
*
|
||||
* @since 1.3.4
|
||||
*/
|
||||
function setClipboard(text) {
|
||||
return sendMessage({
|
||||
method: 'setClipboard',
|
||||
text: text
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Get clipboard text
|
||||
* @returns {Promise<string>}
|
||||
*
|
||||
* @since 1.3.4
|
||||
*/
|
||||
function getClipboard() {
|
||||
return sendMessage({
|
||||
method: 'getClipboard'
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Compute a function with arguments. The function will be executed in the engine pool which is not in the main thread.
|
||||
* @param func {string} - A js code string which can be evaluated to a function. The function will receive the args as its only argument.
|
||||
* @param args {any[]} - The arguments to pass to the function.
|
||||
* @returns {Promise<any>} - The result of the function.
|
||||
* @since 1.5.0
|
||||
*/
|
||||
function compute(func, ...args) {
|
||||
return sendMessage({
|
||||
method: 'compute',
|
||||
function: func,
|
||||
args: args
|
||||
})
|
||||
}
|
||||
|
@@ -4,7 +4,7 @@ class CopyManga extends ComicSource {
|
||||
|
||||
key = "copy_manga"
|
||||
|
||||
version = "1.3.6"
|
||||
version = "1.3.8"
|
||||
|
||||
minAppVersion = "1.2.1"
|
||||
|
||||
@@ -12,30 +12,42 @@ class CopyManga extends ComicSource {
|
||||
|
||||
get headers() {
|
||||
let token = this.loadData("token");
|
||||
let secret = "M2FmMDg1OTAzMTEwMzJlZmUwNjYwNTUwYTA1NjNhNTM="
|
||||
|
||||
let now = new Date(Date.now());
|
||||
let year = now.getFullYear();
|
||||
let month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||
let day = now.getDate().toString().padStart(2, '0');
|
||||
let ts = Math.floor(now.getTime() / 1000).toString()
|
||||
|
||||
if (!token) {
|
||||
token = "";
|
||||
} else {
|
||||
token = " " + token;
|
||||
}
|
||||
let now = new Date(Date.now());
|
||||
let year = now.getFullYear();
|
||||
let month = (now.getMonth() + 1).toString().padStart(2, '0');
|
||||
let day = now.getDate().toString().padStart(2, '0');
|
||||
|
||||
let sig = Convert.hmacString(
|
||||
Convert.decodeBase64(secret),
|
||||
Convert.encodeUtf8(ts),
|
||||
"sha256"
|
||||
)
|
||||
|
||||
return {
|
||||
"User-Agent": "COPY/2.3.2",
|
||||
"User-Agent": "COPY/3.0.0",
|
||||
"source": "copyApp",
|
||||
"deviceinfo": this.deviceinfo,
|
||||
"dt": `${year}.${month}.${day}`,
|
||||
"platform": "3",
|
||||
"referer": `com.copymanga.app-2.3.2`,
|
||||
"version": "2.3.2",
|
||||
"referer": `com.copymanga.app-3.0.0`,
|
||||
"version": "3.0.0",
|
||||
"device": this.device,
|
||||
"pseudoid": this.pseudoid,
|
||||
"Accept": "application/json",
|
||||
"region": this.copyRegion,
|
||||
"authorization": `Token${token}`,
|
||||
"umstring": "b4c89ca4104ea9a97750314d791520ac",
|
||||
"x-auth-timestamp": ts,
|
||||
"x-auth-signature": sig,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -596,7 +608,7 @@ class CopyManga extends ComicSource {
|
||||
let getChapters = async (id, groups) => {
|
||||
let fetchSingle = async (id, path) => {
|
||||
let res = await Network.get(
|
||||
`${this.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=500&offset=0&in_mainland=true&request_id=`,
|
||||
`${this.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=100&offset=0&in_mainland=true&request_id=`,
|
||||
this.headers
|
||||
);
|
||||
if (res.status !== 200) {
|
||||
@@ -610,11 +622,11 @@ class CopyManga extends ComicSource {
|
||||
eps.set(id, title);
|
||||
});
|
||||
let maxChapter = data.results.total;
|
||||
if (maxChapter > 500) {
|
||||
let offset = 500;
|
||||
if (maxChapter > 100) {
|
||||
let offset = 100;
|
||||
while (offset < maxChapter) {
|
||||
res = await Network.get(
|
||||
`${this.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=500&offset=${offset}`,
|
||||
`${this.apiUrl}/api/v3/comic/${id}/group/${path}/chapters?limit=100&offset=${offset}`,
|
||||
this.headers
|
||||
);
|
||||
if (res.status !== 200) {
|
||||
@@ -626,7 +638,7 @@ class CopyManga extends ComicSource {
|
||||
let id = e.uuid;
|
||||
eps.set(id, title)
|
||||
});
|
||||
offset += 500;
|
||||
offset += 100;
|
||||
}
|
||||
}
|
||||
return eps;
|
||||
|
@@ -7,7 +7,7 @@ class Ehentai extends ComicSource {
|
||||
// unique id of the source
|
||||
key = "ehentai"
|
||||
|
||||
version = "1.1.3"
|
||||
version = "1.1.4"
|
||||
|
||||
minAppVersion = "1.0.0"
|
||||
|
||||
@@ -1182,7 +1182,7 @@ class Ehentai extends ComicSource {
|
||||
if(url.includes('?')) {
|
||||
url = url.split('?')[0]
|
||||
}
|
||||
let reg = RegExp("https?://(e-|ex)hentai.org/g/(\\d+)/(\\w+)/")
|
||||
let reg = RegExp("https?://(e-|ex)hentai.org/g/(\\d+)/(\\w+)/?$")
|
||||
let match = reg.exec(url)
|
||||
if(match) {
|
||||
return `${this.baseUrl}/g/${match[2]}/${match[3]}/`
|
||||
|
128
hitomi.js
128
hitomi.js
@@ -995,7 +995,7 @@ class Hitomi extends ComicSource {
|
||||
// unique id of the source
|
||||
key = "hitomi";
|
||||
|
||||
version = "1.1.1";
|
||||
version = "1.1.2";
|
||||
|
||||
minAppVersion = "1.4.6";
|
||||
|
||||
@@ -1004,7 +1004,7 @@ class Hitomi extends ComicSource {
|
||||
|
||||
galleryCache = [];
|
||||
categoryResultCache = undefined;
|
||||
searchResultCache = undefined;
|
||||
searchResultCaches = new Map();
|
||||
|
||||
_mapGalleryBlockInfoToComic(n) {
|
||||
return new Comic({
|
||||
@@ -1088,95 +1088,24 @@ class Hitomi extends ComicSource {
|
||||
title: "hitomi.la",
|
||||
parts: [
|
||||
{
|
||||
name: "Language",
|
||||
name: "语言",
|
||||
type: "fixed",
|
||||
categories: [
|
||||
{
|
||||
label: "Chinese",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "language",
|
||||
param: "chinese",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "English",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "language",
|
||||
param: "english",
|
||||
},
|
||||
},
|
||||
},
|
||||
],
|
||||
categories: ["汉语", "英语"],
|
||||
itemType: "category",
|
||||
categoryParams: ["language:chinese", "language:english"],
|
||||
},
|
||||
{
|
||||
name: "类别",
|
||||
type: "fixed",
|
||||
categories: [
|
||||
{
|
||||
label: "doujinshi",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "doujinshi",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "manga",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "manga",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "artistcg",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "artistcg",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "gamecg",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "gamecg",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "imageset",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "imageset",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
label: "anime",
|
||||
target: {
|
||||
page: "category",
|
||||
attributes: {
|
||||
category: "type",
|
||||
param: "anime",
|
||||
},
|
||||
},
|
||||
},
|
||||
categories: ["同人志", "漫画", "画师CG", "游戏CG", "图集", "动画"],
|
||||
itemType: "category",
|
||||
categoryParams: [
|
||||
"type:doujinshi",
|
||||
"type:manga",
|
||||
"type:artistcg",
|
||||
"type:gamecg",
|
||||
"type:imageset",
|
||||
"type:anime",
|
||||
],
|
||||
},
|
||||
],
|
||||
@@ -1195,9 +1124,11 @@ class Hitomi extends ComicSource {
|
||||
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
||||
*/
|
||||
load: async (category, param, options, page) => {
|
||||
const term = param;
|
||||
if (!term.includes(":"))
|
||||
throw new Error("不合法的标签,请使用namespace:tag的格式");
|
||||
if (page === 1) {
|
||||
const option = parseInt(options[0]);
|
||||
const term = category + ":" + param;
|
||||
const searchOptions = {
|
||||
term,
|
||||
orderby: "date",
|
||||
@@ -1351,6 +1282,7 @@ class Hitomi extends ComicSource {
|
||||
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
||||
*/
|
||||
load: async (keyword, options, page) => {
|
||||
const cacheKey = (keyword || "") + "|" + options.join(",");
|
||||
if (page === 1) {
|
||||
const option = parseInt(options[0]);
|
||||
const term = keyword;
|
||||
@@ -1392,11 +1324,11 @@ class Hitomi extends ComicSource {
|
||||
const comics = (await get_galleryblocks(result.gids)).map((n) =>
|
||||
this._mapGalleryBlockInfoToComic(n)
|
||||
);
|
||||
this.searchResultCache = {
|
||||
this.searchResultCaches.set(cacheKey, {
|
||||
type: "single",
|
||||
state: result.state,
|
||||
count: result.count,
|
||||
};
|
||||
});
|
||||
return {
|
||||
comics,
|
||||
maxPage: Math.ceil(result.count / 25),
|
||||
@@ -1407,20 +1339,21 @@ class Hitomi extends ComicSource {
|
||||
result.gids.slice(25 * page - 25, 25 * page)
|
||||
)
|
||||
).map((n) => this._mapGalleryBlockInfoToComic(n));
|
||||
this.searchResultCache = {
|
||||
this.searchResultCaches.set(cacheKey, {
|
||||
type: "all",
|
||||
gids: result.gids,
|
||||
count: result.count,
|
||||
};
|
||||
});
|
||||
return {
|
||||
comics,
|
||||
maxPage: Math.ceil(result.count / 25),
|
||||
};
|
||||
}
|
||||
} else {
|
||||
if (this.searchResultCache.type === "single") {
|
||||
const searchResultCache = this.searchResultCaches.get(cacheKey);
|
||||
if (searchResultCache.type === "single") {
|
||||
const result = await getSingleTagSearchPage({
|
||||
state: this.searchResultCache.state,
|
||||
state: searchResultCache.state,
|
||||
page: page - 1,
|
||||
});
|
||||
const comics = (await get_galleryblocks(result.galleryids)).map((n) =>
|
||||
@@ -1428,17 +1361,17 @@ class Hitomi extends ComicSource {
|
||||
);
|
||||
return {
|
||||
comics,
|
||||
maxPage: Math.ceil(this.searchResultCache.count / 25),
|
||||
maxPage: Math.ceil(searchResultCache.count / 25),
|
||||
};
|
||||
} else {
|
||||
const comics = (
|
||||
await get_galleryblocks(
|
||||
this.searchResultCache.gids.slice(25 * page - 25, 25 * page)
|
||||
searchResultCache.gids.slice(25 * page - 25, 25 * page)
|
||||
)
|
||||
).map((n) => this._mapGalleryBlockInfoToComic(n));
|
||||
return {
|
||||
comics,
|
||||
maxPage: Math.ceil(this.searchResultCache.count / 25),
|
||||
maxPage: Math.ceil(searchResultCache.count / 25),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -1526,7 +1459,8 @@ class Hitomi extends ComicSource {
|
||||
if ("type" in data && data.type) tags.set("type", [data.type]);
|
||||
if (data.groups.length) tags.set("groups", data.groups);
|
||||
if (data.artists.length) tags.set("artists", data.artists);
|
||||
if ("language" in data && data.language) tags.set("language", [data.language]);
|
||||
if ("language" in data && data.language)
|
||||
tags.set("language", [data.language]);
|
||||
if (data.series.length) tags.set("series", data.series);
|
||||
if (data.characters.length) tags.set("characters", data.characters);
|
||||
if (data.females.length) tags.set("females", data.females);
|
||||
|
130
ikmmh.js
130
ikmmh.js
@@ -1,13 +1,47 @@
|
||||
/** @type {import('./_venera_.js')} */
|
||||
|
||||
function getValidatorCookie(htmlString) {
|
||||
// 正则表达式匹配 document.cookie 设置语句
|
||||
const cookieRegex = /document\.cookie\s*=\s*"([^"]+)"/;
|
||||
const match = htmlString.match(cookieRegex);
|
||||
|
||||
if (!match) {
|
||||
return null; // 没有找到 cookie 设置语句
|
||||
}
|
||||
|
||||
const cookieSetting = match[1];
|
||||
const cookies = cookieSetting.split(';');
|
||||
if (cookies.length === 0) {
|
||||
return null
|
||||
}
|
||||
const nameValuePart = cookies[0].trim();
|
||||
const equalsIndex = nameValuePart.indexOf('=');
|
||||
|
||||
const name = nameValuePart.substring(0, equalsIndex);
|
||||
const value = nameValuePart.substring(equalsIndex + 1);
|
||||
|
||||
return new Cookie({ name, value, domain: "www.ikmmh.com" })
|
||||
}
|
||||
|
||||
function needPassValidator(htmlString) {
|
||||
var cookie = getValidatorCookie(htmlString)
|
||||
if (cookie != null) {
|
||||
Network.setCookies(Ikm.baseUrl, [cookie])
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
class Ikm extends ComicSource {
|
||||
// 基础配置
|
||||
name = "爱看漫";
|
||||
key = "ikmmh";
|
||||
version = "1.0.4";
|
||||
version = "1.0.5";
|
||||
minAppVersion = "1.0.0";
|
||||
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/ikmmh.js";
|
||||
// 常量定义
|
||||
static baseUrl = "https://ymcdnyfqdapp.ikmmh.com";
|
||||
static Mobile_UA = "Mozilla/5.0 (Linux; Android) Mobile";
|
||||
static baseUrl = "https://www.ikmmh.com";
|
||||
static Mobile_UA = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_5 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.5 Mobile/15E148 Safari/604.1 Edg/140.0.0.0";
|
||||
static webHeaders = {
|
||||
"User-Agent": Ikm.Mobile_UA,
|
||||
"Accept":
|
||||
@@ -38,14 +72,26 @@ class Ikm extends ComicSource {
|
||||
);
|
||||
if (res.status !== 200)
|
||||
throw new Error(`登录失败,状态码:${res.status}`);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.post(
|
||||
`${Ikm.baseUrl}/api/user/userarr/login`,
|
||||
Ikm.jsonHead,
|
||||
`user=${account}&pass=${pwd}`
|
||||
);
|
||||
}
|
||||
|
||||
let data = JSON.parse(res.body);
|
||||
if (data.code !== 0) throw new Error(data.msg || "登录异常");
|
||||
if (data.code !== 0)
|
||||
throw new Error(data.msg || "登录异常");
|
||||
|
||||
return "ok";
|
||||
} catch (err) {
|
||||
throw new Error(`登录失败:${err.message}`);
|
||||
}
|
||||
},
|
||||
logout: () => Network.deleteCookies("ymcdnyfqdapp.ikmmh.com"),
|
||||
logout: () => Network.deleteCookies("www.ikmmh.com"),
|
||||
registerWebsite: `${Ikm.baseUrl}/user/register/`,
|
||||
};
|
||||
// 探索页面
|
||||
@@ -58,6 +104,12 @@ class Ikm extends ComicSource {
|
||||
let res = await Network.get(`${Ikm.baseUrl}/`, Ikm.webHeaders);
|
||||
if (res.status !== 200)
|
||||
throw new Error(`加载探索页面失败,状态码:${res.status}`);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(`${Ikm.baseUrl}/`, Ikm.webHeaders);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
let parseComic = (e) => {
|
||||
let title = e.querySelector("div.title").text.split("~")[0];
|
||||
@@ -176,6 +228,15 @@ class Ikm extends ComicSource {
|
||||
);
|
||||
if (res.status !== 200)
|
||||
throw new Error(`分类请求失败,状态码:${res.status}`);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(
|
||||
`${Ikm.baseUrl}/update/${param}.html`,
|
||||
Ikm.webHeaders
|
||||
);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
let comics = document.querySelectorAll("li.comic-item").map((e) => ({
|
||||
title: e.querySelector("p.title").text.split("~")[0],
|
||||
@@ -195,6 +256,17 @@ class Ikm extends ComicSource {
|
||||
options[0]
|
||||
}&page=${page}`
|
||||
);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.post(
|
||||
`${Ikm.baseUrl}/api/comic/index/lists`,
|
||||
Ikm.jsonHead,
|
||||
`area=${options[1]}&tags=${encodeURIComponent(category)}&full=${options[0]
|
||||
}&page=${page}`
|
||||
);
|
||||
}
|
||||
|
||||
let resData = JSON.parse(res.body);
|
||||
return {
|
||||
comics: resData.data.map((e) => ({
|
||||
@@ -260,6 +332,15 @@ class Ikm extends ComicSource {
|
||||
`${Ikm.baseUrl}/search?searchkey=${encodeURIComponent(keyword)}`,
|
||||
Ikm.webHeaders
|
||||
);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(
|
||||
`${Ikm.baseUrl}/search?searchkey=${encodeURIComponent(keyword)}`,
|
||||
Ikm.webHeaders
|
||||
);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
return {
|
||||
comics: document.querySelectorAll("li.comic-item").map((e) => ({
|
||||
@@ -286,6 +367,12 @@ class Ikm extends ComicSource {
|
||||
if (isAdding) {
|
||||
// 获取漫画信息
|
||||
let infoRes = await Network.get(comicId, Ikm.webHeaders);
|
||||
|
||||
if (needPassValidator(infoRes.body)) {
|
||||
// rePost
|
||||
infoRes = await Network.get(comicId, Ikm.webHeaders);
|
||||
}
|
||||
|
||||
let name = new HtmlDocument(infoRes.body).querySelector(
|
||||
"meta[property='og:title']"
|
||||
).attributes["content"];
|
||||
@@ -305,6 +392,16 @@ class Ikm extends ComicSource {
|
||||
Ikm.jsonHead,
|
||||
`articleid=${id}`
|
||||
);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.post(
|
||||
`${Ikm.baseUrl}/api/user/bookcase/del`,
|
||||
Ikm.jsonHead,
|
||||
`articleid=${id}`
|
||||
);
|
||||
}
|
||||
|
||||
let data = JSON.parse(res.body);
|
||||
if (data.code !== "0") throw new Error(data.msg || "取消收藏失败");
|
||||
return "ok";
|
||||
@@ -322,6 +419,15 @@ class Ikm extends ComicSource {
|
||||
if (res.status !== 200) {
|
||||
throw "加载收藏失败:" + res.status;
|
||||
}
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(
|
||||
`${Ikm.baseUrl}/user/bookcase`,
|
||||
Ikm.webHeaders
|
||||
);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
return {
|
||||
comics: document.querySelectorAll("div.bookrack-item").map((e) => ({
|
||||
@@ -347,6 +453,12 @@ class Ikm extends ComicSource {
|
||||
console.error("加载收藏页失败:", error);
|
||||
}
|
||||
let res = await Network.get(id, Ikm.webHeaders);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(id, Ikm.webHeaders);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
let comicId = id.match(/\d+/)[0];
|
||||
// 获取章节数据
|
||||
@@ -410,13 +522,19 @@ class Ikm extends ComicSource {
|
||||
cover: e.querySelector("div.thumb_img").attributes["data-src"],
|
||||
id: `${Ikm.baseUrl}${e.querySelector("a").attributes["href"]}`,
|
||||
})),
|
||||
isFavorite: isFavorite,
|
||||
isFavorite: isFavorite,
|
||||
};
|
||||
},
|
||||
onThumbnailLoad: Ikm.thumbConfig,
|
||||
loadEp: async (comicId, epId) => {
|
||||
try {
|
||||
let res = await Network.get(epId, Ikm.webHeaders);
|
||||
|
||||
if (needPassValidator(res.body)) {
|
||||
// rePost
|
||||
res = await Network.get(epId, Ikm.webHeaders);
|
||||
}
|
||||
|
||||
let document = new HtmlDocument(res.body);
|
||||
return {
|
||||
images: document
|
||||
|
16
index.json
16
index.json
@@ -3,7 +3,7 @@
|
||||
"name": "拷贝漫画",
|
||||
"fileName": "copy_manga.js",
|
||||
"key": "copy_manga",
|
||||
"version": "1.3.6"
|
||||
"version": "1.3.8"
|
||||
},
|
||||
{
|
||||
"name": "Komiic",
|
||||
@@ -27,7 +27,7 @@
|
||||
"name": "nhentai",
|
||||
"fileName": "nhentai.js",
|
||||
"key": "nhentai",
|
||||
"version": "1.0.5"
|
||||
"version": "1.0.6"
|
||||
},
|
||||
{
|
||||
"name": "紳士漫畫",
|
||||
@@ -40,13 +40,13 @@
|
||||
"name": "ehentai",
|
||||
"fileName": "ehentai.js",
|
||||
"key": "ehentai",
|
||||
"version": "1.1.3"
|
||||
"version": "1.1.4"
|
||||
},
|
||||
{
|
||||
"name": "禁漫天堂",
|
||||
"fileName": "jm.js",
|
||||
"key": "jm",
|
||||
"version": "1.2.1",
|
||||
"version": "1.3.0",
|
||||
"description": "禁漫天堂漫畫源, 不能使用時請嘗試切換分流"
|
||||
},
|
||||
{
|
||||
@@ -60,7 +60,7 @@
|
||||
"name": "爱看漫",
|
||||
"fileName": "ikmmh.js",
|
||||
"key": "ikmmh",
|
||||
"version": "1.0.4"
|
||||
"version": "1.0.5"
|
||||
},
|
||||
{
|
||||
"name": "少年ジャンプ+",
|
||||
@@ -72,7 +72,7 @@
|
||||
"name": "hitomi.la",
|
||||
"fileName": "hitomi.js",
|
||||
"key": "hitomi",
|
||||
"version": "1.1.1"
|
||||
"version": "1.1.2"
|
||||
},
|
||||
{
|
||||
"name": "comick",
|
||||
@@ -96,7 +96,7 @@
|
||||
"name": "漫画柜",
|
||||
"fileName": "manhuagui.js",
|
||||
"key": "ManHuaGui",
|
||||
"version": "1.0.1"
|
||||
"version": "1.1.0"
|
||||
},
|
||||
{
|
||||
"name": "优酷漫画",
|
||||
@@ -114,6 +114,6 @@
|
||||
"name": "Lanraragi",
|
||||
"fileName": "lanraragi.js",
|
||||
"key": "lanraragi",
|
||||
"version": "1.0.0"
|
||||
"version": "1.1.0"
|
||||
}
|
||||
]
|
||||
|
129
jm.js
129
jm.js
@@ -7,22 +7,22 @@ class JM extends ComicSource {
|
||||
// unique id of the source
|
||||
key = "jm"
|
||||
|
||||
version = "1.2.1"
|
||||
version = "1.3.0"
|
||||
|
||||
minAppVersion = "1.2.5"
|
||||
minAppVersion = "1.5.0"
|
||||
|
||||
static jmVersion = "2.0.1"
|
||||
static jmVersion = "2.0.6"
|
||||
|
||||
static jmPkgName = "com.example.app"
|
||||
|
||||
// update url
|
||||
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/jm.js"
|
||||
|
||||
static apiDomains = [
|
||||
"www.cdnaspa.vip",
|
||||
"www.cdnaspa.club",
|
||||
"www.cdnplaystation6.vip",
|
||||
"www.cdnplaystation6.cc"
|
||||
static fallbackServers = [
|
||||
"www.cdntwice.org",
|
||||
"www.cdnsha.org",
|
||||
"www.cdnaspa.cc",
|
||||
"www.cdnntr.cc",
|
||||
];
|
||||
|
||||
static imageUrl = "https://cdn-msp.jmapinodeudzn.net"
|
||||
@@ -121,11 +121,11 @@ class JM extends ComicSource {
|
||||
* @param showConfirmDialog {boolean}
|
||||
*/
|
||||
async refreshApiDomains(showConfirmDialog) {
|
||||
let url = "https://jmapp03-1308024008.cos.ap-jakarta.myqcloud.com/server-2024.txt"
|
||||
let url = "https://rup4a04-c02.tos-cn-hongkong.bytepluses.com/newsvr-2025.txt"
|
||||
let domainSecret = "diosfjckwpqpdfjkvnqQjsik"
|
||||
let title = ""
|
||||
let message = ""
|
||||
let jm3_Server = []
|
||||
let servers = []
|
||||
let domains = []
|
||||
let res = await fetch(
|
||||
url,
|
||||
@@ -134,20 +134,20 @@ class JM extends ComicSource {
|
||||
if (res.status === 200) {
|
||||
let data = this.convertData(await res.text(), domainSecret)
|
||||
let json = JSON.parse(data)
|
||||
if (json["jm3_Server"]) {
|
||||
if (json["Server"]) {
|
||||
title = "Update Success"
|
||||
message = "\n"
|
||||
jm3_Server = json["jm3_Server"]
|
||||
servers = json["Server"].slice(0, 4)
|
||||
}
|
||||
}
|
||||
if (jm3_Server.length === 0) {
|
||||
if (servers.length === 0) {
|
||||
title = "Update Failed"
|
||||
message = `Using built-in domains:\n\n`
|
||||
domains = JM.apiDomains
|
||||
servers = JM.fallbackServers
|
||||
}
|
||||
for (let [domain, index] of jm3_Server) {
|
||||
message = message + `${index}: ${domain}\n`
|
||||
domains.push(domain)
|
||||
for (let i = 0; i < servers.length; i++) {
|
||||
message = message + `線路${i + 1}: ${servers[i]}\n\n`
|
||||
domains.push(servers[i])
|
||||
}
|
||||
if (showConfirmDialog) {
|
||||
UI.showDialog(
|
||||
@@ -370,6 +370,12 @@ class JM extends ComicSource {
|
||||
/// title of the category page, used to identify the page, it should be unique
|
||||
title: "禁漫天堂",
|
||||
parts: [
|
||||
{
|
||||
name: "每週必看",
|
||||
type: "fixed",
|
||||
categories: ["每週必看"],
|
||||
itemType: "category",
|
||||
},
|
||||
{
|
||||
name: "成人A漫",
|
||||
type: "fixed",
|
||||
@@ -480,33 +486,74 @@ class JM extends ComicSource {
|
||||
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
||||
*/
|
||||
load: async (category, param, options, page) => {
|
||||
param ??= category
|
||||
param = encodeURIComponent(param)
|
||||
let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`)
|
||||
let data = JSON.parse(res)
|
||||
let total = data.total
|
||||
let maxPage = Math.ceil(total / 80)
|
||||
let comics = data.content.map((e) => this.parseComic(e))
|
||||
return {
|
||||
comics: comics,
|
||||
maxPage: maxPage
|
||||
if (category !== "每週必看") {
|
||||
param ??= category
|
||||
param = encodeURIComponent(param)
|
||||
let res = await this.get(`${this.baseUrl}/categories/filter?o=${options[0]}&c=${param}&page=${page}`)
|
||||
let data = JSON.parse(res)
|
||||
let total = data.total
|
||||
let maxPage = Math.ceil(total / 80)
|
||||
let comics = data.content.map((e) => this.parseComic(e))
|
||||
return {
|
||||
comics: comics,
|
||||
maxPage: maxPage
|
||||
}
|
||||
} else {
|
||||
let res = await this.get(`${this.baseUrl}/week/filter?id=${options[0]}&page=1&type=${options[1]}&page=0`)
|
||||
let data = JSON.parse(res)
|
||||
let comics = data.list.map((e) => this.parseComic(e))
|
||||
return {
|
||||
comics: comics,
|
||||
maxPage: 1
|
||||
}
|
||||
}
|
||||
},
|
||||
// provide options for category comic loading
|
||||
optionList: [
|
||||
{
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
"mr-最新",
|
||||
"mv-總排行",
|
||||
"mv_m-月排行",
|
||||
"mv_w-周排行",
|
||||
"mv_t-日排行",
|
||||
"mp-最多圖片",
|
||||
"tf-最多喜歡",
|
||||
],
|
||||
/**
|
||||
* [Optional] load options dynamically. If `optionList` is provided, this will be ignored.
|
||||
* @param category {string}
|
||||
* @param param {string?}
|
||||
* @return {Promise<{options: string[], label?: string}[]>} - return a list of option group, each group contains a list of options
|
||||
*/
|
||||
optionLoader: async (category, param) => {
|
||||
if (category !== "每週必看") {
|
||||
return [
|
||||
{
|
||||
label: "排序",
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
"mr-最新",
|
||||
"mv-總排行",
|
||||
"mv_m-月排行",
|
||||
"mv_w-周排行",
|
||||
"mv_t-日排行",
|
||||
"mp-最多圖片",
|
||||
"tf-最多喜歡",
|
||||
],
|
||||
}
|
||||
]
|
||||
} else {
|
||||
let res = await this.get(`${this.baseUrl}/week`)
|
||||
let data = JSON.parse(res)
|
||||
let options = []
|
||||
for (let e of data["categories"]) {
|
||||
options.push(`${e["id"]}-${e["time"]}`)
|
||||
}
|
||||
return [
|
||||
{
|
||||
label: "時間",
|
||||
options: options,
|
||||
},
|
||||
{
|
||||
label: "類型",
|
||||
options: [
|
||||
"manga-日漫",
|
||||
"hanman-韓漫",
|
||||
"another-其他",
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
ranking: {
|
||||
// For a single option, use `-` to separate the value and text, left for value, right for text
|
||||
options: [
|
||||
|
45
lanraragi.js
45
lanraragi.js
@@ -2,23 +2,34 @@
|
||||
class Lanraragi extends ComicSource {
|
||||
name = "Lanraragi"
|
||||
key = "lanraragi"
|
||||
version = "1.0.0"
|
||||
version = "1.1.0"
|
||||
minAppVersion = "1.4.0"
|
||||
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/lanraragi.js"
|
||||
|
||||
settings = {
|
||||
api: { title: "API", type: "input", default: "http://lrr.tvc-16.science" }
|
||||
api: { title: "API", type: "input", default: "http://lrr.tvc-16.science" },
|
||||
apiKey: { title: "APIKEY", type: "input", default: "" }
|
||||
}
|
||||
get baseUrl() {
|
||||
|
||||
get baseUrl() {
|
||||
const api = this.loadSetting('api') || this.settings.api.default
|
||||
|
||||
return api.replace(/\/$/, '')
|
||||
}
|
||||
|
||||
get headers() {
|
||||
let apiKey = this.loadSetting('apiKey')
|
||||
if (apiKey) apiKey = "Bearer " + Convert.encodeBase64(Convert.encodeUtf8(apiKey))
|
||||
|
||||
return {
|
||||
"Authorization": `${apiKey}`,
|
||||
}
|
||||
}
|
||||
|
||||
async init() {
|
||||
try {
|
||||
const url = `${this.baseUrl}/api/categories`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) { this.saveData('categories', []); return }
|
||||
let data = []
|
||||
try { data = JSON.parse(res.body) } catch (_) { data = [] }
|
||||
@@ -39,7 +50,7 @@ class Lanraragi extends ComicSource {
|
||||
explore = [
|
||||
{ title: "Lanraragi", type: "multiPageComicList", load: async (page = 1) => {
|
||||
const url = `${this.baseUrl}/api/archives`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const list = data.slice((page-1)*50, page*50)
|
||||
@@ -114,7 +125,7 @@ class Lanraragi extends ComicSource {
|
||||
add('search[regex]', 'false')
|
||||
|
||||
const url = `${base}/search?${qp.join('&')}`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const list = Array.isArray(data.data) ? data.data : []
|
||||
@@ -169,7 +180,7 @@ class Lanraragi extends ComicSource {
|
||||
add('groupby_tanks', groupby)
|
||||
|
||||
const url = `${base}/api/search?${qp.join('&')}`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const all = Array.isArray(data.data) ? data.data : []
|
||||
@@ -225,7 +236,7 @@ class Lanraragi extends ComicSource {
|
||||
comic = {
|
||||
loadInfo: async (id) => {
|
||||
const url = `${this.baseUrl}/api/archives/${id}/metadata`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const cover = `${this.baseUrl}/api/archives/${id}/thumbnail`
|
||||
@@ -237,7 +248,7 @@ class Lanraragi extends ComicSource {
|
||||
},
|
||||
loadThumbnails: async (id, next) => {
|
||||
const metaUrl = `${this.baseUrl}/api/archives/${id}/metadata`
|
||||
const res = await Network.get(metaUrl)
|
||||
const res = await Network.get(metaUrl, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const pagecount = data.pagecount || 1
|
||||
@@ -249,7 +260,7 @@ class Lanraragi extends ComicSource {
|
||||
loadEp: async (comicId, epId) => {
|
||||
const base = (this.baseUrl || '').replace(/\/$/, '')
|
||||
const url = `${base}/api/archives/${comicId}/files?force=false`
|
||||
const res = await Network.get(url)
|
||||
const res = await Network.get(url, this.headers)
|
||||
if (res.status !== 200) throw `Invalid status code: ${res.status}`
|
||||
const data = JSON.parse(res.body)
|
||||
const images = (data.pages || []).map(p => {
|
||||
@@ -260,8 +271,16 @@ class Lanraragi extends ComicSource {
|
||||
}).filter(Boolean)
|
||||
return { images }
|
||||
},
|
||||
// onImageLoad: (url, comicId, epId) => ({}),
|
||||
// onThumbnailLoad: (url) => ({}),
|
||||
onImageLoad: (url, comicId, epId) => {
|
||||
return {
|
||||
headers: this.headers
|
||||
}
|
||||
},
|
||||
onThumbnailLoad: (url) => {
|
||||
return {
|
||||
headers: this.headers
|
||||
}
|
||||
},
|
||||
// likeComic: async (id, isLike) => {},
|
||||
// loadComments: async (comicId, subId, page, replyTo) => {},
|
||||
// sendComment: async (comicId, subId, content, replyTo) => {},
|
||||
@@ -272,4 +291,4 @@ class Lanraragi extends ComicSource {
|
||||
// link: { domains: ['example.com'], linkToId: (url) => null },
|
||||
enableTagsTranslate: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
478
manhuagui.js
478
manhuagui.js
@@ -1,23 +1,68 @@
|
||||
/** @type {import('./_venera_.js')} */
|
||||
class ManHuaGui extends ComicSource {
|
||||
// Note: The fields which are marked as [Optional] should be removed if not used
|
||||
|
||||
// name of the source
|
||||
name = "漫画柜";
|
||||
|
||||
// unique id of the source
|
||||
key = "ManHuaGui";
|
||||
|
||||
version = "1.0.1";
|
||||
version = "1.1.0";
|
||||
|
||||
minAppVersion = "1.4.0";
|
||||
|
||||
// update url
|
||||
url =
|
||||
"https://git.nyne.dev/nyne/venera-configs/raw/branch/main/manhuagui.js";
|
||||
url = "https://git.nyne.dev/nyne/venera-configs/raw/branch/main/manhuagui.js";
|
||||
|
||||
baseUrl = "https://www.manhuagui.com";
|
||||
|
||||
account = {
|
||||
login: async (username, password) => {
|
||||
let headers = {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
'accept': 'application/json, text/javascript, */*; q=0.01',
|
||||
'accept-language': 'zh-CN,zh;q=0.9,en;q=0.8',
|
||||
'cache-control': 'no-cache',
|
||||
'pragma': 'no-cache',
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
'origin': this.baseUrl,
|
||||
'referer': `${this.baseUrl}/`,
|
||||
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36'
|
||||
};
|
||||
let body = `txtUserName=${encodeURIComponent(username)}&txtPassword=${encodeURIComponent(password)}`;
|
||||
let res = await Network.post(`${this.baseUrl}/tools/submit_ajax.ashx?action=user_login`, headers, body);
|
||||
if (res.status !== 200) {
|
||||
throw "Invalid status code: " + res.status;
|
||||
}
|
||||
|
||||
let setCookieHeader = res.headers['set-cookie'];
|
||||
if (!setCookieHeader) {
|
||||
throw "Set-Cookie header not found";
|
||||
}
|
||||
|
||||
let cookies = Array.isArray(setCookieHeader) ? setCookieHeader : [setCookieHeader];
|
||||
let myCookie = null;
|
||||
|
||||
for (let cookie of cookies) {
|
||||
let match = cookie.match(/my=([^;]+)/);
|
||||
if (match) {
|
||||
myCookie = match[1];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!myCookie) {
|
||||
throw "my cookie not found in Set-Cookie header";
|
||||
}
|
||||
|
||||
this.saveData('mhg_cookie', "my="+myCookie);
|
||||
return "ok";
|
||||
},
|
||||
|
||||
logout: function() {
|
||||
this.deleteData('mhg_cookie');
|
||||
},
|
||||
|
||||
registerWebsite: "https://www.manhuagui.com/user/register"
|
||||
|
||||
};
|
||||
|
||||
isAppVersionAfter(target) {
|
||||
if (!APP || !APP.version) return false;
|
||||
let current = APP.version;
|
||||
@@ -32,9 +77,10 @@ class ManHuaGui extends ComicSource {
|
||||
}
|
||||
|
||||
async getHtml(url) {
|
||||
let mhg_cookie = this.loadData("mhg_cookie");
|
||||
let headers = {
|
||||
accept:
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7",
|
||||
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
||||
"cache-control": "no-cache",
|
||||
pragma: "no-cache",
|
||||
@@ -48,9 +94,9 @@ class ManHuaGui extends ComicSource {
|
||||
"sec-fetch-site": "same-origin",
|
||||
"sec-fetch-user": "?1",
|
||||
"upgrade-insecure-requests": "1",
|
||||
cookie: "country=US",
|
||||
Referer: "https://www.manhuagui.com/",
|
||||
"Referrer-Policy": "strict-origin-when-cross-origin",
|
||||
cookie: mhg_cookie
|
||||
};
|
||||
let res = await Network.get(url, headers);
|
||||
if (res.status !== 200) {
|
||||
@@ -60,15 +106,30 @@ class ManHuaGui extends ComicSource {
|
||||
return document;
|
||||
}
|
||||
parseSimpleComic(e) {
|
||||
let url = e.querySelector(".ell > a").attributes["href"];
|
||||
let urlElement = e.querySelector(".ell > a");
|
||||
if (!urlElement) {
|
||||
console.warn("parseSimpleComic: Missing .ell > a element");
|
||||
return null;
|
||||
}
|
||||
let url = urlElement.attributes["href"];
|
||||
let id = url.split("/")[2];
|
||||
let title = e.querySelector(".ell > a").text.trim();
|
||||
let cover = e.querySelector("img").attributes["src"];
|
||||
let title = urlElement.text.trim();
|
||||
|
||||
let imgElement = e.querySelector("img");
|
||||
if (!imgElement) {
|
||||
console.warn("parseSimpleComic: Missing img element");
|
||||
return null;
|
||||
}
|
||||
let cover = imgElement.attributes["src"] || imgElement.attributes["data-src"];
|
||||
if (!cover) {
|
||||
cover = e.querySelector("img").attributes["data-src"];
|
||||
console.warn("parseSimpleComic: Missing cover attribute");
|
||||
return null;
|
||||
}
|
||||
cover = `https:${cover}`;
|
||||
let description = e.querySelector(".tt").text.trim();
|
||||
|
||||
let descriptionElement = e.querySelector(".tt");
|
||||
let description = descriptionElement ? descriptionElement.text.trim() : "";
|
||||
|
||||
return new Comic({
|
||||
id,
|
||||
title,
|
||||
@@ -81,7 +142,6 @@ class ManHuaGui extends ComicSource {
|
||||
let simple = this.parseSimpleComic(e);
|
||||
let sl = e.querySelector(".sl");
|
||||
let status = sl ? "连载" : "完结";
|
||||
// 如果能够找到 <span class="updateon">更新于:2020-03-31<em>3.9</em></span> 解析 更新和评分
|
||||
let tmp = e.querySelector(".updateon").childNodes;
|
||||
let update = tmp[0].replace("更新于:", "").trim();
|
||||
let tags = [status, update];
|
||||
@@ -398,47 +458,42 @@ class ManHuaGui extends ComicSource {
|
||||
// explore page list
|
||||
explore = [
|
||||
{
|
||||
// title of the page.
|
||||
// title is used to identify the page, it should be unique
|
||||
title: "漫画柜",
|
||||
|
||||
/// multiPartPage or multiPageComicList or mixed
|
||||
type: "singlePageWithMultiPart",
|
||||
|
||||
type: "multiPartPage",
|
||||
/**
|
||||
* load function
|
||||
* @param page {number | null} - page number, null for `singlePageWithMultiPart` type
|
||||
* @returns {{}}
|
||||
* - for `multiPartPage` type, return [{title: string, comics: Comic[], viewMore: PageJumpTarget}]
|
||||
* - for `multiPageComicList` type, for each page(1-based), return {comics: Comic[], maxPage: number}
|
||||
* - for `mixed` type, use param `page` as index. for each index(0-based), return {data: [], maxPage: number?}, data is an array contains Comic[] or {title: string, comics: Comic[], viewMore: string?}
|
||||
* 参考 manhuagui_explore.html,抓取“热门漫画最新更新”与 tab 板块
|
||||
*/
|
||||
load: async (page) => {
|
||||
let document = await this.getHtml(this.baseUrl);
|
||||
// log("info", this.name, `获取主页成功`);
|
||||
let tabs = document.querySelectorAll("#cmt-tab li");
|
||||
// log("info", this.name, tabs);
|
||||
let parts = document.querySelectorAll("#cmt-cont ul");
|
||||
// log("info", this.name, parts);
|
||||
let result = {};
|
||||
// tabs len = parts len
|
||||
for (let i = 0; i < tabs.length; i++) {
|
||||
let title = tabs[i].text.trim();
|
||||
let comics = parts[i]
|
||||
.querySelectorAll("li")
|
||||
.map((e) => this.parseSimpleComic(e));
|
||||
result[title] = comics;
|
||||
}
|
||||
// log("info", this.name, result);
|
||||
return result;
|
||||
},
|
||||
let parts = [];
|
||||
|
||||
/**
|
||||
* Only use for `multiPageComicList` type.
|
||||
* `loadNext` would be ignored if `load` function is implemented.
|
||||
* @param next {string | null} - next page token, null if first page
|
||||
* @returns {Promise<{comics: Comic[], next: string?}>} - next is null if no next page.
|
||||
*/
|
||||
// 1. 热门漫画最新更新
|
||||
let updateSection = document.querySelector(".update-cont");
|
||||
if (updateSection) {
|
||||
let updateComics = [];
|
||||
let uls = updateSection.querySelectorAll("ul");
|
||||
for (let ul of uls) {
|
||||
let comics = ul.querySelectorAll("li").map(e => this.parseSimpleComic(e)).filter(c => c);
|
||||
updateComics.push(...comics);
|
||||
}
|
||||
if (updateComics.length > 0) {
|
||||
parts.push({ title: "热门漫画最新更新", comics: updateComics });
|
||||
}
|
||||
}
|
||||
|
||||
// 2. tab 板块(热门连载漫画、经典完结漫画、最新上架漫画、2020新番漫画)
|
||||
let tabTitles = document.querySelectorAll("#cmt-tab li");
|
||||
let tabParts = document.querySelectorAll("#cmt-cont ul.cover-list");
|
||||
for (let i = 0; i < tabTitles.length; i++) {
|
||||
let title = tabTitles[i].text.trim();
|
||||
let comics = tabParts[i].querySelectorAll("li").map(e => this.parseSimpleComic(e)).filter(c => c);
|
||||
if (comics.length > 0) {
|
||||
parts.push({ title, comics });
|
||||
}
|
||||
}
|
||||
|
||||
return parts;
|
||||
},
|
||||
loadNext(next) {},
|
||||
},
|
||||
];
|
||||
@@ -555,6 +610,7 @@ class ManHuaGui extends ComicSource {
|
||||
let genre = param;
|
||||
let age = options[1];
|
||||
let status = options[2];
|
||||
let sort = options[3] || "index";
|
||||
// log(
|
||||
// "info",
|
||||
// this.name,
|
||||
@@ -563,7 +619,7 @@ class ManHuaGui extends ComicSource {
|
||||
// 字符串之间用“_”连接,空字符串除外
|
||||
let params = [area, genre, age, status].filter((e) => e != "").join("_");
|
||||
|
||||
let url = `${this.baseUrl}/list/${params}/index_p${page}.html`;
|
||||
let url = `${this.baseUrl}/list/${params}/${sort}_p${page}.html`;
|
||||
|
||||
let document = await this.getHtml(url);
|
||||
let maxPage = document
|
||||
@@ -572,7 +628,8 @@ class ManHuaGui extends ComicSource {
|
||||
maxPage = parseInt(maxPage);
|
||||
let comics = document
|
||||
.querySelectorAll("#contList > li")
|
||||
.map((e) => this.parseSimpleComic(e));
|
||||
.map((e) => this.parseSimpleComic(e))
|
||||
.filter((comic) => comic !== null); // 过滤掉 null 值
|
||||
return {
|
||||
comics,
|
||||
maxPage,
|
||||
@@ -604,6 +661,9 @@ class ManHuaGui extends ComicSource {
|
||||
{
|
||||
options: ["-全部", "lianzai-连载", "wanjie-完结"],
|
||||
},
|
||||
{
|
||||
options: ["update-最新更新", "index-最新发布", "view-人气最旺", "rate-评分最高"],
|
||||
},
|
||||
],
|
||||
ranking: {
|
||||
// 对于单个选项,使用“-”分隔值和文本,左侧为值,右侧为文本
|
||||
@@ -848,7 +908,6 @@ class ManHuaGui extends ComicSource {
|
||||
let groupName = chapterGroups[i].text.trim();
|
||||
let groupChapters = new Map();
|
||||
|
||||
// 获取对应的章节列表
|
||||
let chapterList = document.querySelectorAll(".chapter-list")[i];
|
||||
if (chapterList) {
|
||||
let lis = chapterList.querySelectorAll("li");
|
||||
@@ -859,32 +918,25 @@ class ManHuaGui extends ComicSource {
|
||||
groupChapters.set(id, title);
|
||||
}
|
||||
|
||||
// 章节升序排列
|
||||
groupChapters = new Map([...groupChapters].sort((a, b) => a[0] - b[0]));
|
||||
|
||||
// 将分组添加到总的章节映射中
|
||||
chaptersMap.set(groupName, groupChapters);
|
||||
}
|
||||
}
|
||||
|
||||
// 兼容旧版本,如果app版本不支持多分组,则合并所有分组
|
||||
let chapters;
|
||||
if (this.isAppVersionAfter && this.isAppVersionAfter("1.3.0")) {
|
||||
// 支持多分组
|
||||
chapters = chaptersMap;
|
||||
} else {
|
||||
// 合并所有分组
|
||||
chapters = new Map();
|
||||
for (let [_, groupChapters] of chaptersMap) {
|
||||
for (let [id, title] of groupChapters) {
|
||||
chapters.set(id, title);
|
||||
}
|
||||
}
|
||||
// 章节升序
|
||||
chapters = new Map([...chapters].sort((a, b) => a[0] - b[0]));
|
||||
}
|
||||
|
||||
//ANCHOR - 推荐
|
||||
let recommend = [];
|
||||
let similar = document.querySelector(".similar-list");
|
||||
if (similar) {
|
||||
@@ -919,7 +971,6 @@ class ManHuaGui extends ComicSource {
|
||||
let script = document.querySelectorAll("script")[4].innerHTML;
|
||||
let infos = this.getImgInfos(script);
|
||||
|
||||
// https://us.hamreus.com/ps3/y/yiquanchaoren/第190话重制版/003.jpg.webp?e=1754143606&m=DPpelwkhr-pS3OXJpS6VkQ
|
||||
let imgDomain = `https://us.hamreus.com`;
|
||||
let images = [];
|
||||
for (let f of infos.files) {
|
||||
@@ -927,7 +978,6 @@ class ManHuaGui extends ComicSource {
|
||||
imgDomain + infos.path + f + `?e=${infos.sl.e}&m=${infos.sl.m}`;
|
||||
images.push(imgUrl);
|
||||
}
|
||||
// log("warning", this.name, images);
|
||||
return {
|
||||
images,
|
||||
};
|
||||
@@ -993,5 +1043,307 @@ class ManHuaGui extends ComicSource {
|
||||
headers,
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* [Optional] load comments
|
||||
*
|
||||
* Since app version 1.0.6, rich text is supported in comments.
|
||||
* Following html tags are supported: ['a', 'b', 'i', 'u', 's', 'br', 'span', 'img'].
|
||||
* span tag supports style attribute, but only support font-weight, font-style, text-decoration.
|
||||
* All images will be placed at the end of the comment.
|
||||
* Auto link detection is enabled, but only http/https links are supported.
|
||||
* @param comicId {string}
|
||||
* @param subId {string?} - ComicDetails.subId
|
||||
* @param page {number}
|
||||
* @param replyTo {string?} - commentId to reply, not null when reply to a comment
|
||||
* @returns {Promise<{comments: Comment[], maxPage: number?}>}
|
||||
*/
|
||||
loadComments: async (comicId, subId, page, replyTo) => {
|
||||
if(replyTo){
|
||||
page = replyTo.split('//')[1];
|
||||
replyTo = replyTo.split('//')[0];
|
||||
}
|
||||
|
||||
let url = `${this.baseUrl}/tools/submit_ajax.ashx?action=comment_list&book_id=${comicId}&page_index=${page}`;
|
||||
|
||||
let headers = {
|
||||
accept: "application/json, text/javascript, */*; q=0.01",
|
||||
"accept-language": "zh-CN,zh;q=0.9,en;q=0.8,en-GB;q=0.7,en-US;q=0.6",
|
||||
"cache-control": "no-cache",
|
||||
pragma: "no-cache",
|
||||
"sec-ch-ua": '"Microsoft Edge";v="137", "Chromium";v="137", "Not/A)Brand";v="24"',
|
||||
"sec-ch-ua-mobile": "?0",
|
||||
"sec-ch-ua-platform": '"Windows"',
|
||||
"sec-fetch-dest": "empty",
|
||||
"sec-fetch-mode": "cors",
|
||||
"sec-fetch-site": "same-origin",
|
||||
"x-requested-with": "XMLHttpRequest",
|
||||
Referer: `${this.baseUrl}/comic/${comicId}/`,
|
||||
"Referrer-Policy": "strict-origin-when-cross-origin",
|
||||
};
|
||||
|
||||
let res = await Network.get(url, headers);
|
||||
|
||||
if (res.status !== 200) {
|
||||
throw `获取评论失败,状态码: ${res.status}`;
|
||||
}
|
||||
|
||||
let data = JSON.parse(res.body);
|
||||
|
||||
const replyChains = new Map();
|
||||
const isSubReply = new Set();
|
||||
const replyToMap = new Map();
|
||||
|
||||
if (data.commentIds && data.commentIds.length > 0) {
|
||||
for (let commentIdString of data.commentIds) {
|
||||
const commentIds = commentIdString.split(',');
|
||||
if (commentIds.length > 1) {
|
||||
const mainCommentId = commentIds[commentIds.length - 1];
|
||||
|
||||
if (!replyChains.has(mainCommentId)) {
|
||||
replyChains.set(mainCommentId, []);
|
||||
}
|
||||
|
||||
for (let i = 0; i < commentIds.length - 1; i++) {
|
||||
const replyId = commentIds[i];
|
||||
isSubReply.add(replyId); // 标记为子回复
|
||||
|
||||
if (!replyChains.get(mainCommentId).includes(replyId)) {
|
||||
replyChains.get(mainCommentId).push(replyId);
|
||||
}
|
||||
|
||||
const targetId = (i === 0) ? mainCommentId : commentIds[i + 1];
|
||||
replyToMap.set(replyId, targetId);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const commentList = [];
|
||||
|
||||
if (data.comments) {
|
||||
if (replyTo) {
|
||||
const replies = [...(replyChains.get(replyTo) || [])].reverse();
|
||||
|
||||
for (let replyId of replies) {
|
||||
const comment = data.comments[replyId];
|
||||
if (comment) {
|
||||
const directReplyToId = replyToMap.get(replyId);
|
||||
let replyUserName = "";
|
||||
if (directReplyToId && directReplyToId !== replyTo && data.comments[directReplyToId]) {
|
||||
replyUserName = data.comments[directReplyToId].user_name || "匿名用户";
|
||||
}
|
||||
|
||||
commentList.push(new Comment({
|
||||
id: `${comment.id}//${page}`,
|
||||
userName: replyUserName ?
|
||||
`${comment.user_name || "匿名用户"} ☞ ${replyUserName}` :
|
||||
comment.user_name || "匿名用户",
|
||||
avatar: comment.avatar ? `https:${comment.avatar}` : "https://cf.mhgui.com/images/default.png",
|
||||
content: comment.content ? comment.content : "已隐藏评论",
|
||||
time: comment.add_time,
|
||||
replyCount: 0, // 回复的回复暂不支持
|
||||
}));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const mainComments = [];
|
||||
for (const [id, comment] of Object.entries(data.comments)) {
|
||||
if (!isSubReply.has(id)) {
|
||||
const replyCount = replyChains.has(id) ? replyChains.get(id).length : (comment.reply_count || 0);
|
||||
mainComments.push(new Comment({
|
||||
id: `${comment.id}//${page}`,
|
||||
userName: comment.user_name || "匿名用户",
|
||||
avatar: comment.avatar ? `https:${comment.avatar}` : "https://cf.mhgui.com/images/default.png",
|
||||
content: comment.content ? comment.content : "已隐藏评论",
|
||||
time: comment.add_time,
|
||||
replyCount: replyCount,
|
||||
}));
|
||||
}
|
||||
}
|
||||
commentList.push(...mainComments.reverse());
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
comments: commentList,
|
||||
maxPage: replyTo ? 1 : (Math.ceil(data.total / 10) || 1)
|
||||
};
|
||||
},
|
||||
|
||||
/**
|
||||
* 处理标签点击事件
|
||||
* @param namespace {string} 标签命名空间
|
||||
* @param tag {string} 标签名称
|
||||
* @returns {Object} 跳转操作
|
||||
*/
|
||||
onClickTag: (namespace, tag) => {
|
||||
// 点击类型标签时,跳转到对应的分类页面
|
||||
if (namespace === "类型") {
|
||||
// 根据标签查找对应的参数值
|
||||
const categoryPart = this.category.parts.find(part => part.name === "类型");
|
||||
if (categoryPart) {
|
||||
const index = categoryPart.categories.findIndex(cat => cat === tag);
|
||||
if (index !== -1) {
|
||||
const param = categoryPart.categoryParams[index];
|
||||
return {
|
||||
action: 'category',
|
||||
keyword: tag,
|
||||
param: param
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
if (namespace === "作者") {
|
||||
return {
|
||||
action: 'search',
|
||||
keyword: tag,
|
||||
param: tag
|
||||
};
|
||||
}
|
||||
|
||||
// 默认返回null,表示不处理此类标签点击
|
||||
return null;
|
||||
},
|
||||
};
|
||||
/// favorites related
|
||||
favorites = {
|
||||
multiFolder: false,
|
||||
/**
|
||||
* load comics of the favorites
|
||||
* @param page {number} - page number
|
||||
* @param folder {string?} - folder name, unused for now
|
||||
* @returns {Promise<{comics: Comic[], maxPage: number}>}
|
||||
*/
|
||||
loadComics: async (page, folder) => {
|
||||
let mhg_cookie = this.loadData("mhg_cookie");
|
||||
if (!mhg_cookie) {
|
||||
throw "请先登录漫画柜账号";
|
||||
}
|
||||
let url = `${this.baseUrl}/user/book/shelf/${page}`;
|
||||
let document = await this.getHtml(url);
|
||||
let comicElements = document.querySelectorAll('.dy_content_li');
|
||||
let comics = [];
|
||||
for (let el of comicElements) {
|
||||
let a = el.querySelector('.dy_img a');
|
||||
if (!a) continue;
|
||||
let href = a.attributes['href'];
|
||||
let id = href.split('/')[2];
|
||||
let img = a.querySelector('img');
|
||||
let cover = img ? (img.attributes['src'] || img.attributes['data-src']) : '';
|
||||
if (cover && !cover.startsWith('http')) cover = 'https:' + cover;
|
||||
// dy_r 解析详细信息
|
||||
let dy_r = el.querySelector('.dy_r');
|
||||
let title = '';
|
||||
let updateTitle = '';
|
||||
let updateChapter = '';
|
||||
let updateDate = '';
|
||||
let lastReadChapter = '';
|
||||
let lastReadDate = '';
|
||||
if (dy_r) {
|
||||
// 标题
|
||||
let h3 = dy_r.querySelector('h3');
|
||||
if (h3) {
|
||||
let h3a = h3.querySelector('a');
|
||||
if (h3a) title = h3a.text.trim();
|
||||
}
|
||||
// 更新内容
|
||||
let pList = dy_r.querySelectorAll('p');
|
||||
if (pList.length > 0) {
|
||||
let updateP = pList[0];
|
||||
let updateEm = updateP.querySelectorAll('em');
|
||||
if (updateEm.length > 0) {
|
||||
let chapterA = updateEm[0].querySelector('a');
|
||||
if (chapterA) updateChapter = chapterA.text.trim();
|
||||
updateDate = updateEm.length > 1 ? updateEm[1].text.trim() : '';
|
||||
}
|
||||
updateTitle = updateP.text.replace(/更新内容:/, '').trim();
|
||||
}
|
||||
// 最近阅读
|
||||
if (pList.length > 1) {
|
||||
let readP = pList[1];
|
||||
let readEm = readP.querySelectorAll('em');
|
||||
if (readEm.length > 0) {
|
||||
let lastA = readEm[0].querySelector('a');
|
||||
if (lastA) lastReadChapter = lastA.text.trim();
|
||||
lastReadDate = readEm.length > 1 ? readEm[1].text.trim() : '';
|
||||
}
|
||||
}
|
||||
}
|
||||
// 兼容无dy_r时的title
|
||||
if (!title) {
|
||||
if (a.attributes['title']) {
|
||||
title = a.attributes['title'];
|
||||
} else {
|
||||
title = a.text.trim();
|
||||
}
|
||||
}
|
||||
// tags 信息
|
||||
let tags = [];
|
||||
if (updateChapter) tags.push(`更新:${updateChapter}`);
|
||||
if (updateDate) tags.push(`更新日期:${updateDate}`);
|
||||
if (lastReadChapter) tags.push(`最近阅读:${lastReadChapter}`);
|
||||
if (lastReadDate) tags.push(`最近阅读时间:${lastReadDate}`);
|
||||
comics.push(new Comic({
|
||||
id,
|
||||
title,
|
||||
subTitle: updateChapter || updateTitle || '',
|
||||
cover,
|
||||
description: '',
|
||||
tags,
|
||||
}));
|
||||
}
|
||||
// 页码信息
|
||||
let maxPage = 1;
|
||||
// 优先用“共N记录”计算
|
||||
let recordInfo = document.querySelector('.flickr.right span');
|
||||
if (recordInfo) {
|
||||
let match = recordInfo.text.match(/共(\d+)记录/);
|
||||
if (match) {
|
||||
let total = parseInt(match[1], 10);
|
||||
maxPage = Math.ceil(total / 20);
|
||||
}
|
||||
} else {
|
||||
// 兼容旧逻辑
|
||||
let pageBtns = document.querySelectorAll('.page-btns a');
|
||||
for (let btn of pageBtns) {
|
||||
let num = parseInt(btn.text.trim(), 10);
|
||||
if (!isNaN(num) && num > maxPage) maxPage = num;
|
||||
}
|
||||
}
|
||||
return {
|
||||
comics,
|
||||
maxPage
|
||||
};
|
||||
},
|
||||
addOrDelFavorite: async (comicId, folderId, isAdding, favoriteId) => {
|
||||
if (!isAdding) {
|
||||
throw '暂不支持取消收藏';
|
||||
}
|
||||
let mhg_cookie = this.loadData("mhg_cookie");
|
||||
if (!mhg_cookie) {
|
||||
throw "请先登录漫画柜账号";
|
||||
}
|
||||
let url = `${this.baseUrl}/tools/submit_ajax.ashx?action=user_book_shelf_add`;
|
||||
let headers = {
|
||||
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8',
|
||||
'x-requested-with': 'XMLHttpRequest',
|
||||
'referer': `${this.baseUrl}/comic/${comicId}/`,
|
||||
cookie: mhg_cookie,
|
||||
};
|
||||
let body = `book_id=${encodeURIComponent(comicId)}`;
|
||||
let res = await Network.post(url, headers, body);
|
||||
if (res.status !== 200) {
|
||||
throw `添加收藏失败,状态码: ${res.status}`;
|
||||
}
|
||||
let data = {};
|
||||
try {
|
||||
data = JSON.parse(res.body);
|
||||
} catch (e) {}
|
||||
if (data.state !== true && data.state !== 1) {
|
||||
throw data.msg || '添加收藏失败';
|
||||
}
|
||||
return 'ok';
|
||||
},
|
||||
};
|
||||
}
|
||||
|
@@ -7,7 +7,7 @@ class Nhentai extends ComicSource {
|
||||
// unique id of the source
|
||||
key = "nhentai"
|
||||
|
||||
version = "1.0.5"
|
||||
version = "1.0.6"
|
||||
|
||||
minAppVersion = "1.0.0"
|
||||
|
||||
@@ -523,7 +523,7 @@ class Nhentai extends ComicSource {
|
||||
'nhentai.net',
|
||||
],
|
||||
linkToId: (url) => {
|
||||
let regex = /\/g\/(\d+)\//g
|
||||
let regex = /\/g\/(\d+)\/?$/g
|
||||
let match = regex.exec(url)
|
||||
if(match) {
|
||||
return match[1]
|
||||
|
Reference in New Issue
Block a user