[{"bookSourceComment":"\/\/ 按照发现页的分类进行搜索\n\/\/ @author: syiism","bookSourceGroup":"5漫画","bookSourceName":"多多少少","bookSourceType":2,"bookSourceUrl":"https:\/\/ios.pipigou507.top","customButton":true,"customOrder":722,"enabled":true,"enabledCookieJar":true,"enabledExplore":true,"eventListener":false,"exploreUrl":"<js>\nlet res = [];\nlet _zwf = \"※\";\nlet numx = 3;\n\nfunction push(title, url, num, g,action) {\n    let j = {\n    title: title,\n    url: url,\n    style: {\n        layout_flexGrow: g == 0 ? g : 1,\n        layout_flexBasisPercent: num\n    }\n  }\n     if(action){\n         j.action = action.action;\n         j.name = action.name;\n         j.type = action.type;\n         j.chars = action.chars;\n         j.viewName = action.viewName;\n         j.default = action.default;      \n     }     \n     res.push(j)\t\n}\n\nfunction zwf(len,numx,num) {\n  if(len % numx !== 0) {\n    let n = len % numx;\n    let p = numx - n;\n      \n    for(let i=0;i<p;i++) {\n      push(_zwf, '', num, 1,{\n      \"type\":\"button\",\n      \"action\":\"java.toast('这是占位符')\"});\n    }\n  }\n}\n\n\/\/ 大类\nlet defaultV = \"漫画\";\npush(\"模式\", \"\", 1, 1, {\n  \"type\": \"select\",\n  \"chars\": [\"漫画\", \"里番\"],\n  \"action\": `switchMode(${'infoMap[\"模式\"]'})`,\n  \"default\": defaultV\n});\n\nif (infoMap[\"模式\"] == \"漫画\") {\n  var labels = getLabels(infoMap[\"模式\"]);\n  labels = JSON.parse(labels);\n \n  \/\/ 子类1\n  \/\/ 一级子类\n  let groups = labels['groups'].map(x => x.type);\n  push('分组', '', 0.45, 1, {\n    \"type\": \"select\",\n    \"chars\": groups,\n    \"action\": `switchGroup(\"${infoMap['分组']}\")`,\n    \"default\": groups[0]\n  });\n\n  \/\/ 二级子类\n  let _labels = {};\n  let __labels = {};\n  labels['groups'].forEach(x => {\n    _labels[x.type] = x.labels.map(x=>x.cn+'('+x.count+')');\n    x.labels.forEach(item => {\n      const key = `${item.cn}(${item.count})`;\n      __labels[key] = item.name;\n    });\n  });\n\n  defaultV = _labels[groups[0]][0];\n  push('标签', '', 0.45, 1, {\n    \"type\": \"select\",\n    \"chars\": _labels[infoMap['分组']],\n    \"action\": `switchLabel(\"${infoMap['标签']}\")`,\n    \"default\": defaultV\n  });\n\n  \/\/ 子类2\n  let chars2 = [\"最新\", \"评分\", \"收藏\", \"浏览\", \"最早\"];\n  let _chars2 = {\n    \"最新\": \"latest\",\n    \"评分\": \"rating\",\n    \"收藏\": \"favorites\",\n    \"浏览\": \"view_count\",\n    \"最早\": \"oldest\"\n  };\n  defaultV = chars2[0];\n  push('排序', '', 0.45, 1, {\n    \"type\": \"select\",\n    \"chars\": chars2,\n    \"action\": `switchLabel2(\"${infoMap['排序']}\")`,\n    \"default\": defaultV\n  });\n\n  \/\/ 子类3\n  let chars3 = ['全部', '最近7天', '最近30天'];\n  let _chars3 = {'全部': 'all', '最近7天': '7d', '最近30天': '30d'};\n  defaultV = chars3[0]\n  push('时间', '', 0.45, 1, {\n    \"type\": \"select\",\n    \"chars\": chars3,\n    \"action\": `switchLabel3(\"${infoMap['时间']}\")`,\n    \"default\": defaultV\n  });\n\n  \/\/ 是否显示 bl\n  push('bl  (点我切换)', '', 1, 1, {\n    \"type\": \"toggle\",\n    \"chars\": [\"不显示\", \"显示\"],\n    \"action\": `isShowBl('');`,\n    \"default\": \"不显示\"\n  });\n  \n  let url = `https:\/\/macapi1.com\/ehentai\/galleries?page={{page}}&page_size=20&label=${__labels[infoMap['标签']]}&sort=${_chars2[infoMap['排序']]}&time_range=${_chars3[infoMap['时间']]}&show_bl=${infoMap['bl  (点我切换)'] == \"不显示\"?0:1}`;\n  push('go，go，go！出发喽！', url, 1, 1, { });\n\n} else if (infoMap[\"模式\"] == \"里番\") {\n  var labels = getLabels(infoMap[\"模式\"]);\n  labels = JSON.parse(labels);\n  labels = labels['data'];\n  \/\/ 子类\n  let url = 'https:\/\/macapi1.com\/anilist\/works?page={{page}}&page_size=20&genre={genre}&sort=latest';\n  for (let i = 0; i < labels.length; i ++) {\n    push(\n      labels[i].genre_zh+'('+labels[i].count+')', \n      url.replace(\/{genre}\/, labels[i].genre), \n      0.33, 1, {});\n  }\n zwf(labels.length, 2, 0.33);\n}\n\nJSON.stringify(res);\n<\/js>","header":"{\n\"user-agent\": \"Mozilla\/5.0 (X11; Linux x86_64) AppleWebKit\/537.36 (KHTML, like Gecko) Chrome\/149.0.0.0 Safari\/537.36\"\n}","jsLib":"function getLabels(m) {\n  const { java, source } = this;\n  java.toast(m)\n  \/\/ 获取当前模式的缓存key\n  const cacheKey = m == '漫画' ? 'mh_labels' : 'lf_labels';\n  const cached = source.get(cacheKey);\n  const upTime = source.get('upTime');\n  \n  \/\/ 有缓存且未过期，直接返回\n  if (cached != '' && upTime != '' && upTime > Date.now()) {\n    return cached;\n  }\n  \n  \/\/ 请求新数据\n  const url = m == '漫画' \n    ? 'https:\/\/macapi1.com\/ehentai\/content-labels'\n    : 'https:\/\/macapi1.com\/anilist\/genres';\n  \n  if (!url) return null;\n  \n  const resp = java.ajax(url);\n  \n  \/\/ 更新缓存\n  if (resp) {\n    source.put(cacheKey, resp);\n    source.put('upTime', Date.now() + 21600000);\n  }\n  \n  return resp;\n}\n\nfunction switchMode(m) {\n  const { java, source } = this;\n  source.put('mode', m);\n  java.toast(m)\n  java.refreshExplore()\n}\n\nfunction switchGroup(m) {\n  const { java, source } = this;\n  source.put('group', m);\n  java.refreshExplore()\n}\n\nfunction switchLabel(m) {\n  const { java, source } = this;\n  source.put('label', m);\n  java.refreshExplore()\n}\n\nfunction switchLabel2(m) {\n  const { java, source } = this;\n  source.put('label1', m);\n  java.refreshExplore();\n}\n\nfunction switchLabel3(m) {\n  const { java, source } = this;\n  source.put('label2', m);\n  java.refreshExplore()\n}\n\nfunction isShowBl(m) {\n  const { java, source } = this;\n  \/\/source.put('is_bl', m);\n  java.refreshExplore();\n}\n","lastUpdateTime":"1781195098281","respondTime":180000,"ruleBookInfo":{"intro":"$.cn_description||$.data.description_zh","tocUrl":"<js>\nlet url = ''\nif (source.get('mode') == '里番') {\n  url = baseUrl +'\/episodes';\n}\nurl;\n<\/js>"},"ruleContent":{"content":"<js>\nif (source.get('mode') == '漫画') {\nvar match = baseUrl.match(\/page_count=(\\d+)&page=(\\d+)&gallery_id=(\\d+)\/);\nvar page_count = match[1], \n    page = match[2],\n    gallery_id = match[3];\n\nvar perPage = 20;\nvar start = (page - 1) * perPage + 1;\nvar end = Math.min(page * perPage, page_count);\n\nvar imgs = '\\n';\nfor (let i = start; i <= end; i ++) { \n  imgs += '<img src=\"' + `https:\/\/eh.lashayu.com\/ehentai\/gallery\/${gallery_id}\/res\/${i}.webp` + '\">\\n';\n}\nimgs;\n}\nif (source.get('mode') == '里番') {\n  \n  result = JSON.parse(result);\n  let playUrl = result.list[0].vod_play_url;\n  playUrl = playUrl.split('$')[1]\n  playUrl;\n}\n<\/js>","imageStyle":"FULL"},"ruleExplore":{"author":"$.tags.artist||$.studios[0].name","bookList":"$.items||$.data","bookUrl":"@js:\n(function(result) {\nif (source.get('mode') == '漫画')\n  return `https:\/\/macapi1.com\/ehentai\/galleries\/${result._id}`;\nif (source.get('mode') == '里番')\n return `https:\/\/macapi1.com\/anilist\/works\/${result.id}`;\n})(result);","coverUrl":"$.cover_url||$.coverImage.large","kind":"<js>\nlet res = [];\nif (source.get('mode') == '漫画') {\nres.push(`★ ${result.rating}`);\nres.push(`👁️ ${result.view_count}`);\nlet tags = result.tags;\nfor (let x in tags) {\n  res.push(tags[x][0]);\n}\nres.push(`${result.page_count}p`);\nres.push(`${result.posted_at.split('T')[0]}`);\n}\n\nif (source.get('mode') == '里番') {\nres.push(`👁️ ${result.view_count}`);\nres.push(result.endDate.year);\nres.push(result.status);\nres.push(result.format);\nresult.genres_zh.forEach(x=>{res.push(x);})\n}\nres.join(',');\n<\/js>","name":"$.cn_title||$.title.zh||$.title.display||$.title"},"ruleSearch":{"author":"$.tags.artist||$.studios[0].name","bookList":"$.items||$.data","bookUrl":"@js:\n(function(result) {\nif (source.get('mode') == '漫画')\n  return `https:\/\/macapi1.com\/ehentai\/galleries\/${result._id}`;\nif (source.get('mode') == '里番')\n return `https:\/\/macapi1.com\/anilist\/works\/${result.id}`;\n})(result);","checkKeyWord":"无修","coverUrl":"$.cover_url||$.coverImage.large","kind":"{{`★ ${result.rating}`}},{{result.tags.parody[0]}},{{`${result.page_count}p`}},{{`${result.posted_at}`}}","name":"$.cn_title||$.title.display||$.title"},"ruleToc":{"chapterList":"<js>\nvar res = [];\nif (source.get('mode') == '漫画') {\nbook.type = 64;\nresult = JSON.parse(result)\nvar gallery_id = result['gallery_id'];\nvar page_count = result['page_count']\nvar page = Math.floor(page_count \/ 20) + 1;\nfor (let i = 1; i <= page; i ++) {\n  res.push(JSON.stringify({\n    \"text\": `第${i}话`,\n    \"href\": `${baseUrl}?page_count=${page_count}&page=${i}&gallery_id=${gallery_id}`\n  }));\n}\n}\nif (source.get('mode') == '里番') {\n  book.type = 4;\n  result = JSON.parse(result);\n  let ed = result.data.episodes;\n  java.log(ed)\n  for (let i = 0; i < ed.length; i ++) {\n  \t  res.push(JSON.stringify({\n  \t  \t  \"text\": `第${i+1}话`,\n  \t  \t  \"href\": `https:\/\/macapi1.com\/maccms\/json\/${ed[i].sources[0].dname}\/?ac=videolist&ids=${ed[i].sources[0].vod_id}`\n  \t}));\n}\n}\nres;\n<\/js>","chapterName":"$.text","chapterUrl":"$.href"},"searchUrl":"@js:\nlet mode = source.get('mode');\nlet uri = (mode == '漫画' ? '\/ehentai\/galleries' : '\/anilist\/search');\n`https:\/\/macapi1.com${uri}?q=${key}&page=${page}&page_size=25&sort=latest&time_range=all&show_bl=0`","weight":0}]