酷安
https://api.coolapk.com
分享者: guaner001125 (317)发布时间: 2023/08/15
该用户很懒,什么介绍也没有写!
{ "articleStyle": 0, "customOrder": 0, "enableJs": true, "enabled": true, "enabledCookieJar": true, "header": "<js>\nlet TOKEN = 'token:\/\/com.coolapk.market\/c67ef5943784d09750dcfbb31020f0ab?'\nlet PACKAGE_NAME = 'com.coolapk.market';\nlet DEVICE_ID = String(java.randomUUID());\nlet APP_DEVICE = (length => {\n let chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'\n let result = ''\n for (var i = length; i > 0; --i) {\n result += chars[Math.floor(Math.random() * chars.length)]\n }\n return result\n})(50);\n\n let t = parseInt(Date.now() \/ 1000)\n let hex_t = `0x${t.toString(16)}`\n let md5_t = java.digestHex(t.toString(), \"md5\")\n let a = `${TOKEN}${md5_t}$${DEVICE_ID}&${PACKAGE_NAME}`;\n let md5_a = java.digestHex(String(java.base64Encode(a)),\"md5\")\n let token = `${md5_a}${DEVICE_ID}${hex_t}`\n\nhead = {\n 'User-Agent': 'Dalvik\/2.1.0 (Linux; U; Android 10; Pixel 4 XL Build\/QQ2A.200405.005) +CookMarket\/10.1.2-2004302',\n 'X-Requested-With': 'XMLHttpRequest',\n 'X-Sdk-Int': '29',\n 'X-Sdk-Locale': 'zh-CN',\n 'X-App-Id': 'com.coolapk.market',\n 'X-App-Version': '10.1.2',\n 'X-App-Code': '2004302',\n 'X-App-Token': token,\n 'X-Api-Version': '10',\n 'X-App-Device': APP_DEVICE,\n 'X-Dark-Mode': '0'\n }\nJSON.stringify(head)\n<\/js>", "jsLib": "function pad(s) {\n return s < 10 ? `0${s}` : s\n}\n\nfunction formatDate(timeStamp){\n\tlet diff = (Date.now() - timeStamp * 1000) \/ 1000\n if (diff < 60) {\n return '刚刚'\n } else if (diff < 3600) {\n return `${parseInt(diff \/ 60)}分钟前`\n } else if (diff < 86400) {\n return `${parseInt(diff \/ 3600)}小时前`\n } else if (diff < 604800) {\n return `${parseInt(diff \/ 86400)}天前`\n } else if (diff < 2592000) {\n return `${parseInt(diff \/ 604800)}周前`\n } else if (diff < 31104000) {\n return `${parseInt(diff \/ 2592000)}个月前`\n } else {\n let date = new Date(timeStamp * 1000)\n return `${date.getFullYear()}-${pad(date.getMonth() + 1)}-${pad(date.getDate())}`\n }\n\t}\n\t\nfunction createReply(item, addDivider, addPadding) {\n let html = addDivider && `<hr class='hr'>` || ''\n if (addPadding) {\n html += `<div class='box-horizontal padding'>`\n html += `<div class='line-vertical'><\/div>`\n html += `<div class='box-vertical'>`\n }\n html += `<div class='box-horizontal'>`\n html += `<img class='avatar' src=${item.userAvatar} \/>`\n html += `<div class='box-vertical'>`\n html += `<div class='font-medium'>${item.username}<\/div>`\n html += `<div class='font-small color-grey'>${formatDate(item.dateline)}<\/div>`\n html += `<\/div>`\n html += `<\/div>`\n html += `<div class='p'><\/div>`\n item.message.split(\/\\r?\\n\/).map(it => {\n html += `<div class='font-medium'>${it}<\/div>`\n })\n if (item.picArr && item.picArr.length) {\n html += `<div id='box' class='p'>`\n item.picArr.filter(it => it).map(it => {\n html += `<img onload=\"box.viewer.update()\" class='image' src='${it}' \/>`\n })\n html += `<\/div>`\n } else if (item.pic) {\n html += `<div class='p'><\/div>`\n html += `<a href=\"${item.pic}\"><img class='image' onload=\"box.viewer.update()\" src='${item.pic}' \/><\/a>`\n }\n if (addPadding) {\n html += `<\/div>`\n html += `<\/div>`\n }\n return html\n }", "lastUpdateTime": 0, "loadWithBaseUrl": true, "ruleArticles": "$.data[*]", "ruleContent": "@js:\nif(!\/apk\\\/detail\/.test(baseUrl)){\n let html = `\n<link rel=\"stylesheet\" href=\"https:\/\/cdn.bootcdn.net\/ajax\/libs\/viewerjs\/1.10.2\/viewer.min.css\">\n<script src=\"https:\/\/cdn.bootcdn.net\/ajax\/libs\/viewerjs\/1.10.2\/viewer.min.js\"><\/script>`;\n html += `<style>\n .p { margin-top: 12px; }\n .box-vertical { display: flex; flex-direction: column; word-wrap: break-word; word-break: break-all; }\n #box{height:320px}\n #box,.box-horizontal{ display: flex; flex-direction: row; overflow: scroll; }\n .font-small { font-size: 13px; }\n .font-medium { font-size: 15px; }\n .color-grey { color: grey; }\n .avatar { width: 30px; height: 30px; margin-right: 6px;border-radius:50% }\n .image { flex: 0 0 auto; margin-left: 1px;min-width:160px }\n .hr { width: 100%; height: 1px; border: none; border-top: thin solid #eee; }\n .padding { padding-left: 40px; }\n .line-vertical { margin-right: 6px; border-left: thin solid #eee; }\n <\/style>`\n html += `<div class='box-vertical'>`\n let id = \"{{$.data.id}}\";\n let item = JSON.parse(result).data;\n html += createReply(item)\n let curPage = 1;\n let item_reply = []\n let totalnum = 0;\n let lastItem =\"\"\n let resp2 = JSON.parse(java.ajax(\"https:\/\/api.coolapk.com\/v6\/feed\/replyList?id={{$.data.id}}&page=1&lastItem=\"));\n let item2 = resp2.data\n item_reply = item_reply.concat(item2)\n let replynum5 = item.replynum;\n replynum5 > 100?replynum5=100:replynum5\n while (item2.length && (totalnum = totalnum + item2.length) < replynum5) {\n curPage = curPage + 1\n lastItem = item2[item2.length - 1].id\n resp2 = resp2 = JSON.parse(java.ajax(`https:\/\/api.coolapk.com\/v6\/feed\/replyList?id=${id}&page=${curPage}&lastItem=${lastItem}`))\n item2 = resp2.data\n item_reply = item_reply.concat(item2)\n }\n\n let grouped_item_reply = {}\n item_reply.map(item => {\n if (item.rrid) {\n grouped_item_reply[item.rrid] = grouped_item_reply[item.rrid] || []\n grouped_item_reply[item.rrid].push(item)\n } else {\n grouped_item_reply[item.id] = grouped_item_reply[item.id] || []\n grouped_item_reply[item.id].push(item)\n }\n })\n for (key in grouped_item_reply) {\n grouped_item_reply[key].sort((e1, e2) => {\n return e1.dateline - e2.dateline\n }).map(item => html += createReply(item, true, !!item.rrid))\n }\n\n html += `<\/div>`\n html += `<script>\n box = document.getElementById(\"box\");\n \n window.onload = () => {new Viewer(box,{title:false,interval:3000})\n }\n <\/script>`\n result = html\n }else{\n \thtml = `<p><h2><img style=\"width:30px;heigth:30px\" src=\"{{$.data.logo}}\">{{$.data.title}} <button onclick=\"c()\">点击按钮复制分类Url规则粘贴查看评论<\/button><\/h2> <a href=\"https:\/\/www.coolapk.com\/apk\/{{$.data.apkname}}\">软件地址<\/a> <\/p>\n \t<p>☼版本号:{{$.data.version}}<\/p>\n<p>☉最近更新:{{$.data.changehistory##\\n.*}}<\/p>\n<p>☪︎{{$.data.apksize}}\/{{$.data.downCount}}下载\/{{$.data.followCount}}人关注\/{{$.data.commentCount}}人评论\/{{$.data.language}}<\/p>\n<br>‎<br>\n<p>📖新版特性📖<\/p>\n{{$.data.changelog}}\n<br>‎<br>\n<p>📖应用介绍📖<\/p>\n{{$.data.introduce}}`\n \t\n \thtml += `<textarea id=\"textarea\" readonly>{{$.data.title}}▪回复::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id={{$.data.id}}&sort=&title=最近回复&page={\\{page}}&lastItem=\\n`\n\nhtml += \"{{$.data.title}}▪发布::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id=256030&sort=dateline_desc&title=最近发布&page={\\{page}}&lastItem=\\n\"\n\nhtml += \"{{$.data.title}}▪热度::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id={{$.data.id}}&sort=popular&title=热度排序&page={\\{page}}&lastItem=\\n<\/textarea>\"\nhtml += `<script>\nfunction c() {\n var text = document.getElementById('textarea');\n \/\/ 选中文本\n text.select()\n \/\/ 复制\n document.execCommand('copy');\n alert(\"复制成功,请编辑源粘贴至分类url处\")\n}\n<\/script>`\n \t}", "ruleDescription": "", "ruleImage": "$.pic||$.userAvatar||$.logo", "ruleLink": "<js>\nif(!\/search\/.test(baseUrl)){\n\tresult = \"https:\/\/api.coolapk.com\/v6\/feed\/detail?id={{$.id}}\"\n\t}else{\n\t\tresult = \"https:\/\/api.coolapk.com\/v6\/apk\/detail?id={{$.apkname}}&installed=0\"\n\t\t}\n<\/js>", "ruleNextPage": "page", "rulePubDate": "@js:\nif(!\/search\/.test(baseUrl)){\nlet name = \"{{$.username}}\";\nlet ti = formatDate(java.getString(\"$.dateline\"));\nlet num = Number(\"{{$.replynum}}\");\nresult = `${name}▪发布时间:${ti} ${num}回复${(num && '('+formatDate({{$.lastupdate}})+')') || \"\"}`\n}else{\n\tresult = \"{{$.apksize}}▪下载数:{{$.downCount}}▪评论:{{$.commentCount}}\"\n\t}", "ruleTitle": "$.message||$.origTitle||$.title##<\\\/*a.*?>", "singleUrl": false, "sortUrl": "搜索应用::https:\/\/api.coolapk.com\/v6\/search?type=apk&cat=&sort=default&searchValue={{(source.getVariable()==null||source.getVariable()==\"\")?\"阅读\":source.getVariable()}}&page={{page}}&lastItem=\n\n阅读▪回复::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id=256030&sort=&title=最近回复&page={{page}}&lastItem=\n\n阅读▪发布::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id=256030&sort=dateline_desc&title=最近发布&page={{page}}&lastItem=\n\n阅读▪热度::https:\/\/api.coolapk.com\/v6\/page\/dataList?url=#\/feed\/apkCommentList?id=256030&sort=popular&title=热度排序&page={{page}}&lastItem=", "sourceComment": "来自@cinhoo大佬\n\n设置源变量搜索应用", "sourceIcon": "http:\/\/static.coolapk.com\/images\/header-logo.png", "sourceName": "酷安", "sourceUrl": "https:\/\/api.coolapk.com", "style": "#textarea{\n\tvisibility:hidden\n\t}", "variableComment": "确认后刷新" }