Skip to content
This repository has been archived by the owner on Jul 8, 2024. It is now read-only.

Commit

Permalink
新增api
Browse files Browse the repository at this point in the history
  • Loading branch information
hjdhnx committed Apr 12, 2024
1 parent ae02ade commit 27e21c9
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 4 deletions.
2 changes: 2 additions & 0 deletions doc/写源教程.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ var rule = {
double:true,//是否双层列表定位,默认false
// 对图片加了referer验证的有效,海阔专用,普通规则请勿填写此键值
图片来源:'@Referer=http://www.jianpianapp.com@User-Agent=jianpian-version350',
// 替换所有图片链接 欲替换文本=>替换为文本
图片替换:'https://www.keke6.app/=>https://vres.a357899.cn/',

// js写法,仅js模式1有效.可以用于代码动态获取全局cookie之类的
// 可操作变量有 rule_fetch_params,rule,以及基础的网页访问request,post等操作
Expand Down
2 changes: 1 addition & 1 deletion js/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.49beta37
3.9.49beta38
37 changes: 35 additions & 2 deletions libs/drpy2.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import cheerio from 'assets://js/lib/cheerio.min.js';
import 'assets://js/lib/crypto-js.js';
import 模板 from"../js/模板.js"
import 模板 from"./模板.js"
import {gbkTool} from './gbk.js'
// import './rsa.js'

Expand Down Expand Up @@ -67,7 +67,7 @@ function pre(){

let rule = {};
let vercode = typeof(pdfl) ==='function'?'drpy2.1':'drpy2';
const VERSION = vercode+' 3.9.49beta36 202400410';
const VERSION = vercode+' 3.9.49beta38 202400413';
/** 已知问题记录
* 1.影魔的jinjia2引擎不支持 {{fl}}对象直接渲染 (有能力解决的话尽量解决下,支持对象直接渲染字符串转义,如果加了|safe就不转义)[影魔牛逼,最新的文件发现这问题已经解决了]
* Array.prototype.append = Array.prototype.push; 这种js执行后有毛病,for in 循环列表会把属性给打印出来 (这个大毛病需要重点排除一下)
Expand Down Expand Up @@ -1378,6 +1378,15 @@ function homeVodParse(homeVodObj){
let t2 = (new Date()).getTime();
console.log('加载首页推荐耗时:'+(t2-t1)+'毫秒');
// console.log(JSON.stringify(d));
if(rule.图片替换 && rule.图片替换.includes('=>')){
let replace_from = rule.图片替换.split('=>')[0];
let replace_to = rule.图片替换.split('=>')[1];
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
it.vod_pic = it.vod_pic.replace(replace_from,replace_to);
}
});
}
if(rule.图片来源){
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
Expand Down Expand Up @@ -1513,6 +1522,15 @@ function categoryParse(cateObj) {
console.log(e.message);
}
}
if(rule.图片替换 && rule.图片替换.includes('=>')){
let replace_from = rule.图片替换.split('=>')[0];
let replace_to = rule.图片替换.split('=>')[1];
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
it.vod_pic = it.vod_pic.replace(replace_from,replace_to);
}
});
}
if(rule.图片来源){
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
Expand Down Expand Up @@ -1705,6 +1723,15 @@ function searchParse(searchObj) {
return '{}'
}
}
if(rule.图片替换 && rule.图片替换.includes('=>')){
let replace_from = rule.图片替换.split('=>')[0];
let replace_to = rule.图片替换.split('=>')[1];
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
it.vod_pic = it.vod_pic.replace(replace_from,replace_to);
}
});
}
if(rule.图片来源){
d.forEach(it=>{
if(it.vod_pic&&it.vod_pic.startsWith('http')){
Expand Down Expand Up @@ -1962,6 +1989,11 @@ function detailParse(detailObj){
}
vod.vod_play_url = vod_play_url;
}
if(rule.图片替换 && rule.图片替换.includes('=>')){
let replace_from = rule.图片替换.split('=>')[0];
let replace_to = rule.图片替换.split('=>')[1];
vod.vod_pic = vod.vod_pic.replace(replace_from,replace_to);
}
if(rule.图片来源 && vod.vod_pic && vod.vod_pic.startsWith('http')){
vod.vod_pic = vod.vod_pic + rule.图片来源;
}
Expand Down Expand Up @@ -2257,6 +2289,7 @@ function init(ext) {
rule.encoding = rule.编码||rule.encoding||'utf-8';
rule.search_encoding = rule.搜索编码||rule.search_encoding||'';
rule.图片来源 = rule.图片来源||'';
rule.图片替换 = rule.图片替换||'';
rule.play_json = rule.hasOwnProperty('play_json')?rule.play_json:[];
rule.pagecount = rule.hasOwnProperty('pagecount')?rule.pagecount:{};
rule.proxy_rule = rule.hasOwnProperty('proxy_rule')?rule.proxy_rule:'';
Expand Down
2 changes: 1 addition & 1 deletion libs/drpy2.min.js

Large diffs are not rendered by default.

0 comments on commit 27e21c9

Please sign in to comment.