mirror of
https://github.com/fmz200/wool_scripts.git
synced 2025-12-19 13:41:18 +08:00
Initial commit: new history
This commit is contained in:
104
Scripts/caixin/caixin.js
Normal file
104
Scripts/caixin/caixin.js
Normal file
@ -0,0 +1,104 @@
|
||||
/**
|
||||
* @author fmz200
|
||||
* @function 阅读财新APP会员文章,需要去某宝购买会员卡密
|
||||
* @date 2023-11-22 18:30:13
|
||||
*
|
||||
* hostname = mappsv5.caixin.com
|
||||
* [rewrite_local]
|
||||
* https://mappsv5\.caixin\.com/articlev5/(\d+)/(\d+)\.html url script-response-body caixin.js
|
||||
*/
|
||||
|
||||
let req_url = $request.url;
|
||||
let rsp_body = $response.body;
|
||||
let kami = ''; // 这里填写卡密
|
||||
let articleProperties = {};
|
||||
let articleURL = "";
|
||||
try {
|
||||
modifyMain();
|
||||
} catch (e) {
|
||||
console.log('脚本运行出现错误⚠️');
|
||||
console.log('错误信息:' + e.message);
|
||||
}
|
||||
|
||||
function modifyMain() {
|
||||
console.log('脚本运行开始');
|
||||
if (rsp_body.includes("浏览完整内容,请订阅《财新周刊》")) {
|
||||
console.log('会员文章💕');
|
||||
sign();
|
||||
} else {
|
||||
console.log('普通文章💕');
|
||||
$done({rsp_body});
|
||||
}
|
||||
}
|
||||
|
||||
function sign() {
|
||||
console.log('开始登录💕');
|
||||
const url = `http://113.207.49.170:8801/api/login.php`;
|
||||
const method = `POST`;
|
||||
const headers = {
|
||||
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1`,
|
||||
'Content-Type': 'multipart/form-data; boundary=----WebKitFormBoundarylAGNzd3p4Uf34hmM'
|
||||
};
|
||||
const body = `------WebKitFormBoundarylAGNzd3p4Uf34hmM\nContent-Disposition: form-data; name="kami"\n\n${kami}\n------WebKitFormBoundarylAGNzd3p4Uf34hmM--\n`;
|
||||
const myRequest = {
|
||||
url: url, method: method, headers: headers, body: body
|
||||
};
|
||||
|
||||
$task.fetch(myRequest).then(response => {
|
||||
console.log("登录响应码:" + response.statusCode + "\n\n" + response.body + "\n\n");
|
||||
let authData = JSON.parse(response.body);
|
||||
if (authData.code === 200) {
|
||||
fetchArticle(authData.token);
|
||||
} else {
|
||||
console.log('登录失败❌');
|
||||
}
|
||||
}, reason => {
|
||||
console.log('请求异常❗️');
|
||||
console.log(reason.error);
|
||||
$done({rsp_body});
|
||||
});
|
||||
}
|
||||
|
||||
// 拉取文章
|
||||
function fetchArticle(authData) {
|
||||
// 文章链接示例:https://www.caixin.com/2023-11-20/102137746.html
|
||||
const htmlString = rsp_body;
|
||||
const startTag = '<script';
|
||||
const endTag = '</script>';
|
||||
const keyword = 'articleProperties';
|
||||
const startIndex = htmlString.indexOf(keyword);
|
||||
const startScriptIndex = htmlString.lastIndexOf(startTag, startIndex);
|
||||
const endIndex = htmlString.indexOf(endTag, startIndex);
|
||||
|
||||
if (startIndex !== -1 && startScriptIndex !== -1 && endIndex !== -1) {
|
||||
articleProperties = htmlString.substring(startIndex + 20, endIndex + endTag.length - 10);
|
||||
// console.log(articleProperties);
|
||||
} else {
|
||||
console.log('未找到匹配的内容或者没有包含articleProperties。');
|
||||
}
|
||||
articleURL = JSON.parse(articleProperties).from_web_url;
|
||||
console.log("文章链接:" + articleURL);
|
||||
|
||||
const url = `http://113.207.49.170:8801/api/news.php`;
|
||||
const method = `POST`;
|
||||
const headers = {
|
||||
'User-Agent': `Mozilla/5.0 (iPhone; CPU iPhone OS 17_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/119.0.6045.169 Mobile/15E148 Safari/604.1`,
|
||||
'Cookie': `kami=${kami}; token=${authData}`,
|
||||
};
|
||||
const body = `url=${articleURL}`;
|
||||
|
||||
const myRequest = {
|
||||
url: url, method: method, headers: headers, body: body
|
||||
};
|
||||
|
||||
$task.fetch(myRequest).then(response => {
|
||||
console.log("拉取文章响应码:" + response.statusCode + "\n\n");
|
||||
rsp_body = response.body;
|
||||
console.log("拉取文章结束💕");
|
||||
// console.log("会员文章内容:\n" + new_rsp_body);
|
||||
$done({body: rsp_body});
|
||||
}, reason => {
|
||||
console.log(reason.error);
|
||||
$done({rsp_body});
|
||||
});
|
||||
}
|
||||
4
Scripts/caixin/caixinAd.js
Normal file
4
Scripts/caixin/caixinAd.js
Normal file
@ -0,0 +1,4 @@
|
||||
// 财新
|
||||
|
||||
var __encode ='jsjiami.com',_a={}, _0xb483=["\x5F\x64\x65\x63\x6F\x64\x65","\x68\x74\x74\x70\x3A\x2F\x2F\x77\x77\x77\x2E\x73\x6F\x6A\x73\x6F\x6E\x2E\x63\x6F\x6D\x2F\x6A\x61\x76\x61\x73\x63\x72\x69\x70\x74\x6F\x62\x66\x75\x73\x63\x61\x74\x6F\x72\x2E\x68\x74\x6D\x6C"];(function(_0xd642x1){_0xd642x1[_0xb483[0]]= _0xb483[1]})(_a);var __Oxf34c4=["\x69\x6E\x74\x76\x61\x6C\x22\x3A\x30","\x72\x65\x70\x6C\x61\x63\x65","\x65\x64\x61\x79\x22\x3A\x22\x32\x30\x32\x39\x2D\x31\x32\x2D\x33\x30\x20\x30\x30\x3A\x30\x30\x3A\x30\x30\x22","\x73\x64\x61\x79\x22\x3A\x22\x32\x30\x32\x39\x2D\x31\x32\x2D\x30\x31\x20\x30\x30\x3A\x30\x30\x3A\x30\x30\x22","\x62\x6F\x64\x79","\x75\x6E\x64\x65\x66\x69\x6E\x65\x64","\x6C\x6F\x67","\u5220\u9664","\u7248\u672C\u53F7\uFF0C\x6A\x73\u4F1A\u5B9A","\u671F\u5F39\u7A97\uFF0C","\u8FD8\u8BF7\u652F\u6301\u6211\u4EEC\u7684\u5DE5\u4F5C","\x6A\x73\x6A\x69\x61","\x6D\x69\x2E\x63\x6F\x6D"];var body=$response[__Oxf34c4[0x4]][__Oxf34c4[0x1]](/sday":"[^"]*"/g,__Oxf34c4[0x3])[__Oxf34c4[0x1]](/eday":"[^"]*"/g,__Oxf34c4[0x2])[__Oxf34c4[0x1]](/intval":\d/g,__Oxf34c4[0x0]);$done({body});;;(function(_0x510dx2,_0x510dx3,_0x510dx4,_0x510dx5,_0x510dx6,_0x510dx7){_0x510dx7= __Oxf34c4[0x5];_0x510dx5= function(_0x510dx8){if( typeof alert!== _0x510dx7){alert(_0x510dx8)};if( typeof console!== _0x510dx7){console[__Oxf34c4[0x6]](_0x510dx8)}};_0x510dx4= function(_0x510dx9,_0x510dx2){return _0x510dx9+ _0x510dx2};_0x510dx6= _0x510dx4(__Oxf34c4[0x7],_0x510dx4(_0x510dx4(__Oxf34c4[0x8],__Oxf34c4[0x9]),__Oxf34c4[0xa]));try{_0x510dx2= __encode;if(!( typeof _0x510dx2!== _0x510dx7&& _0x510dx2=== _0x510dx4(__Oxf34c4[0xb],__Oxf34c4[0xc]))){_0x510dx5(_0x510dx6)}}catch(e){_0x510dx5(_0x510dx6)}})({})
|
||||
|
||||
Reference in New Issue
Block a user