Pending changes exported from your codespace

This commit is contained in:
Liu
2024-11-04 03:08:15 +00:00
parent 06f69297cd
commit 9c2112b1e5
10 changed files with 40 additions and 11 deletions

View File

@@ -25,7 +25,25 @@ cheerio.jinja2 = function (template, obj) {
// import {gbkTool} from 'https://ghproxy.net/https://raw.githubusercontent.com/hjdhnx/dr_py/main/libs/gbk.js'
let vercode = typeof (pdfl) === 'function' ? 'drpy2.1' : 'drpy2';
const VERSION = vercode + ' 3.9.51beta5 20241014';
const VERSION = vercode + ' 3.9.51beta5 20241104';
const UpdateInfo = [
{
date: '20241104',
title: 'drpy更新增加新特性',
version: '3.9.51beta5 20241104',
msg: `
1. rule增加 搜索验证标识 属性,可以不定义,默认为 '系统安全验证|请输入验证码'
2. rule增加 searchNoPage 属性,可以不定义,如果定义 1 将关闭该源的搜索翻页功能超过1页直接返回空
`
},
];
function getUpdateInfo() {
return UpdateInfo.map((_o) => {
_o.msg = _o.msg.trim().split('\n').map(_it => _it.trim()).join('\n')
return _o
})
}
function init_test() {
// console.log(typeof(JSON5));
@@ -1744,12 +1762,14 @@ function request(url, obj, ocr_flag) {
obj.redirect = 0;
}
if (obj.headers.hasOwnProperty('Content-Type') || obj.headers.hasOwnProperty('content-type')) {
if (obj.headers["Content-Type"].includes("application/x-www-form-urlencoded")) {
log("body");
let _contentType = obj.headers["Content-Type"] || obj.headers["content-type"] || "";
if (_contentType.includes("application/x-www-form-urlencoded")) {
log("custom body is application/x-www-form-urlencoded");
//console.log(JSON.stringify(obj));
if (typeof obj.body == "string") {
let temp_obj = parseQueryString(obj.body);
//obj.body = objectToQueryString(temp_obj);
console.log(JSON.stringify(temp_obj));
}
}
}
@@ -2411,6 +2431,10 @@ function searchParse(searchObj) {
if (!searchObj.searchUrl) {
return '{}'
}
if (rule.searchNoPage && Number(searchObj.pg) > 1) {
// 关闭搜索分页
return '{}'
}
let p = searchObj.搜索 === '*' && rule.一级 ? rule.一级 : searchObj.搜索;
if (!p || typeof (p) !== 'string') {
return '{}'
@@ -2499,7 +2523,9 @@ function searchParse(searchObj) {
html = getHtml(MY_URL);
}
if (html) {
if (/系统安全验证|输入验证码/.test(html)) {
// 解决搜索源码奇葩触发自动过验证逻辑
let search_tag = rule.搜索验证标识 || '系统安全验证|输入验证码';
if (new RegExp(search_tag).test(html)) {
let cookie = verifyCode(MY_URL);
if (cookie) {
console.log(`本次成功过验证,cookie:${cookie}`);

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@@ -1 +1 @@
e33b10e202795b1611d4ea69c01e3f3b
cd98eca4d35dc0ae49758c07294c558f