diff --git a/repo/wnacg.com.js b/repo/wnacg.com.js
index 0b9bfb6..3e6fafd 100644
--- a/repo/wnacg.com.js
+++ b/repo/wnacg.com.js
@@ -1,6 +1,6 @@
// ==MiruExtension==
// @name 紳士漫畫
-// @version v0.0.1
+// @version v0.0.2
// @author appdevelpo
// @lang zh-tw
// @license MIT
@@ -12,89 +12,329 @@
// ==/MiruExtension==
export default class Mangafx extends Extension {
- async latest(page) {
- const res = await this.request(`/albums-index-page-${page}.html`);
- const bsxList = res.match(/
a");
+ let num_str = "";
+ for (let page_num of pre_page_nums)
+ {
+ num_str = page_num.content.match(/(\d+)/g)[0];
+ }
+ const num = parseInt(num_str);
+ if (res.search(`${num + 1}`) != -1)
+ {
+ return num + 1;
+ }
+ return num;
+ }
+
+ //获取收藏列表
+ async get_fav_lists()
+ {
+ var headers = this.headers;
+ headers["Cookie"] = `MPIC_bnS5=${await this.getSetting("cookies")}`;
+ var fav_lists = {};
+ const res = await this.request(`/users-users_fav.html`, {headers: headers});
+ this.favnum = await this.get_maxnum(res); //获取收藏总页数
+ const items = await this.querySelectorAll(res, "label.nav_list > a");
+ for (const item of items)
+ {
+ let id = "";
+ try
+ {
+ id = "c-" + item.content.match(/(\d+)/g)[0];
+ }
+ catch (e)
+ {
+ id = "all";
+ }
+ const name = item.content.match(/">(.*?)<\/a>/)[1];
+ fav_lists[id] = name;
+ }
+ this.fav_lists = fav_lists;
+ }
+
+ //获取收藏
+ async get_fav(id, page) {
+ //包含用户信息的headers
+ var headers = this.headers;
+ headers["Cookie"] = `MPIC_bnS5=${await this.getSetting("cookies")}`;
+ if (id == "all")
+ {
+ id = "c-0";
+ }
+ const res = await this.request(`/users-users_fav-page-${page}-${id}.html`, {headers: headers});
+ const bsxList = await this.querySelectorAll(res, "div.asTB");
+ const maxnum = await this.get_maxnum(res);
+ console.log(`${page}/${maxnum}`);
+ if (id == "c-0")
+ {
+ //获取收藏最大页数
+ this.favnum = maxnum;
+ }
+ if (page > maxnum)
+ {
+ return [];
+ }
+ const mangas = [];
+ for (const element of bsxList)
+ {
+ const html = element.content;
+ const url = await this.getAttributeText(html, "div.box_cel > p.l_title > a", "href");
+ const title = await this.querySelector(html, "div.box_cel > p.l_title > a").text;
+ const cover = "https:" + await this.getAttributeText(html, "img", "src");
mangas.push({
- title,
- url,
- cover,
+ title: title,
+ url: url,
+ cover: cover,
});
- });
- return mangas;
- }
-
- async search(kw, page) {
- const res = await this.request(`/search/index.php?q=${kw}&m=&syn=yes&f=_all&s=create_time_DESC&p=${page}`);
- const bsxList = res.match(/ 1))
+ {
+ //首页不支持翻页
+ return [];
+ }
+ const res = await this.request(url_str, {headers: this.headers});
+ if ((url_str != "") && (url_str.search("cate") == -1)) //获取目前最大可跳转页数
+ {
+ this.maxnum = await this.get_maxnum(res);
+ }
+ const bsxList = await this.querySelectorAll(res, "li.gallary_item");
+ const mangas = [];
+ for (const element of bsxList)
+ {
+ const html = element.content;
+ const url = await this.getAttributeText(html, "div.pic_box > a", "href");
+ let title = await this.getAttributeText(html, "div.pic_box > a", "title");
+ title = title.replaceAll("", "").replaceAll("", "");
+ const cover = "https:" + await this.getAttributeText(html, "div.pic_box > a > img", "src");
mangas.push({
- title,
- url,
- cover,
+ title: title,
+ url: url,
+ cover: cover,
+ headers: this.headers,
});
- });
- return mangas;
- }
-
- async detail(url) {
-
- const res = await this.request(url);
- const titleRegex = /