茶马小说 [耽美]
https://www.chamabooks.net
jianghubailei (2226)01/08 10:36
发现增加书单
{
"bookSourceGroup": "耽美小说",
"bookSourceName": "茶马小说 [耽美]",
"bookSourceType": 0,
"bookSourceUrl": "https:\/\/www.chamabooks.net",
"bookUrlPattern": "https:\/\/www.chamabooks.net\/novel_.*?.html",
"customButton": false,
"customOrder": 1,
"enabled": true,
"enabledCookieJar": true,
"enabledExplore": true,
"eventListener": false,
"exploreUrl": "@js:\nconst categories = [[\"全部\",\"\"],[\"言情\",\"2\"],[\"耽美\",\"3\"],[\"百合\",\"4\"],[\"武侠\",\"5\"],[\"玄幻\",\"6\"],[\"科幻\",\"7\"],[\"恐怖\",\"8\"],[\"推理\",\"9\"],[\"短篇\",\"12\"]];\nconst tpl = \"\/main?c=$$&p={{page}}\"\n\nconst obj = (title, url, size) => ({\n title,\n url,\n style: {layout_flexBasisPercent: size}\n})\n\nlet list = categories.map(([title, id]) => \n obj(title, tpl.replace(\"$$\", id), 0.2)\n)\n\n\/\/ 在线获取书单(只获取第一页)\ntry {\n let bookList = java.get(\"chamabooks_bookList\");\n let bookListData = [];\n if (bookList) {\n try {\n bookListData = JSON.parse(bookList);\n } catch (e) {\n java.log(\"缓存数据解析失败: \" + e.message);\n }\n }\n \n if (!Array.isArray(bookListData) || bookListData.length === 0) {\n let html = java.ajax(\"https:\/\/www.chamabooks.net\/main?c=100\");\n if (html) {\n let doc = org.jsoup.Jsoup.parse(html);\n let bookListEl = doc.select(\".novel-item h4 a\");\n \n if (bookListEl && bookListEl.size() > 0) {\n bookListData.push(obj(\"书单\", \"\", 1));\n \n bookListEl.forEach(el => {\n let n = String(el.text()).trim();\n let u = String(el.attr(\"href\"));\n bookListData.push(obj(n, u, 0.9));\n });\n \n java.put(\"chamabooks_bookList\", JSON.stringify(bookListData));\n }\n }\n }\n \n if (bookListData.length > 0) {\n list = list.concat(bookListData);\n }\n \n} catch (e) {\n java.log(\"获取书单失败: \" + e.message);\n}\n\nJSON.stringify(list);",
"header": "{\n\t \"User-Agent\":\"Mozilla\/5.0 (iPhone; CPU iPhone OS 17_3 like Mac OS X) AppleWebKit\/605.1.15 (KHTML, like Gecko) Version\/17.3 Mobile\/15E148 Safari\/604.1\",\n\t \"Referer\": \"https:\/\/www.chamabooks.net\/\"\n}",
"lastUpdateTime": "1767839763597",
"loginUrl": "\/",
"respondTime": 180000,
"ruleBookInfo": {
"author": "h1 a@text##作者:",
"coverUrl": "[property=\"og:image\"]@content",
"intro": ".novel-summary-content@html",
"kind": "@js:\nconst get = (sel) => String(java.getString(sel))\nlet cat = book.kind || get(\".category@text\")\nlet count = get(\"@@.misc-value.2@text\");\ncount = count ? \",章节数:\"+count : \"\";\ncat.concat(count)",
"lastChapter": "option.-1@value",
"name": "h1@ownText##《|》",
"wordCount": ".misc-value.1@text##$##字"
},
"ruleContent": {
"content": "#novel-content@html##{{title}}"
},
"ruleExplore": {},
"ruleSearch": {
"author": ".misc-value a@text",
"bookList": ".novel-item",
"bookUrl": "h4 a@href",
"intro": "p.novel-desc@text",
"kind": ".category,.upload-date@text",
"name": "h4 a@text",
"wordCount": ".word-count@text"
},
"ruleToc": {
"chapterList": "option",
"chapterName": "text",
"chapterUrl": "value"
},
"searchUrl": "\/search?s={{key}}",
"weight": 0
}