local curl = require "lcurl.safe"
local json = require "cjson.safe"script_info = {["title"] = "KinhDown引擎",
}function request(url,header)local r = ""local c = curl.easy{url = url,httpheader = header,ssl_verifyhost = 0,ssl_verifypeer = 0,followlocation = 1,timeout = 30,proxy = pd.getProxy(),writefunction = function(buffer)r = r .. bufferreturn #bufferend,}local _, e = c:perform()c:close()return r
endfunction getsub(str,as,ae)
local StrLen = string.len(str)
local as_Len = string.len(as)
local ae_Len = string.len(ae)
local as_x = string.find(str, as, 1)
local ae_x = string.find(str, ae, as_x+1)
local rs = (string.sub(str, as_x+as_Len, ae_x-1))
return rs
endfunction onInitTask(task, user, file)if task:getType() == TASK_TYPE_BAIDU or task:getType() == TASK_TYPE_SHARE_BAIDU thenlocal dlink = ""if task:getType() == TASK_TYPE_BAIDU thenlocal header = {}table.insert(header, "User-Agent: netdisk")table.insert(header, "Cookie: BDUSS="..user:getBDUSS())local fsid = string.format("%d",file.id)local url = "https://pan.baidu.com/rest/2.0/xpan/multimedia?method=filemetas&dlink=1&fsids=%5b"..fsid.."%5d"local result = request(url,header)local resultjson = json.decode(result)if resultjson == nil thentask:setError(-1,"网络错误")pd.logError('网络超时')return trueendlocal dlink = resultjson.list[1].dlinkPath = string.gsub(string.gsub(dlink, "https://d.pcs.baidu.com/file/", ""),"?fid","&fid") endif task:getType() == TASK_TYPE_SHARE_BAIDU thenlocal uk = getsub(file.dlink,"?fid=","-250528-")local shareid = getsub(file.dlink,"&shareid=","&")local md5  = getsub(file.dlink,"https://d.pcs.baidu.com/file/","?fid")local header = {}table.insert(header, "User-Agent: netdisk;11.6.3;android-android;11.0;JSbridge4.4.0")local url = "https://api.kinh.cc/BaiDu/Check/ShUIDSite.php?shareid="..shareid.."&uk="..uklocal result = request(url,header)local sige = getsub(result,'sige":"','","')local devuid = getsub(result,'devuid":"','","')local timestamp = getsub(result,'time":','}')local url = "https://pan.baidu.com/share/list?app_id=250528&clienttype=1&channel=android_11_netdisk&needsublist=1&version=11.6.3&vip=2&shareid="..shareid.."&uk="..uk.."&fid="..file.id.."&sign="..sige.."&timestamp="..timestamp.."&devuid="..devuid.."&time="..timestamplocal result = request(url,header)local resultjson = json.decode(result)local dlink = resultjson.list[1].dlinkif dlink == nil thentask:setError(-1,"无法生成PCS链接")return trueendPath = string.gsub(string.gsub(dlink, "http://d.pcs.baidu.com/file/", ""),"?fid","&fid")endlocal header = {}table.insert(header, "User-Agent: Mozilla/5.0 (KinhDown[DP]Web;PD;2021-2-25;14-40)")local url = "https://pan.kdbaidu.com/Parsing.php?Path="..pd.urlEncode(Path).."&Key="..pd.getConfig("Baidu","accelerateURL")local result = request(url,header)local resultjson = json.decode(result)if resultjson.Code == "-1" thentask:setError(-1,resultjson.Error)return trueendif resultjson.Code == "0" thentask:setUris(resultjson.dlink)task:setOptions("user-agent", resultjson.ua)task:setOptions("piece-length", resultjson.length.."M")task:setOptions("max-connection-per-server",resultjson.split)task:setOptions("split",resultjson.split)task:setOptions("header","Range: bytes="..resultjson.bytes)task:setOptions("allow-piece-length-change","true")task:setOptions("enable-http-pipelining","true")end
return true
end

转自https://kinhdown.kinh.cc/

kinhdown引擎(lua)相关推荐

  1. 使用cocos2dx+lua改造《剑魂之刃》的经验总结

    做智能机以来,一直都是使用的自研引擎.直到今年7月到10月中旬,我带领公司的前端团队,负责改造了同一公司旗下另一家子公司的<剑魂之刃>,对cocos2dx也有了一定的接触. 我所在的璧途科 ...

  2. lua—C/C++lua嵌入式开发

    lua-C/C++lua嵌入式开发 一.lua定位--C/C++嵌入式脚本语言 二.数据类型--table 三.协程 下面重点说一下Lua与C/C++之间的交互 [一]基本配置 [二]进行交互 [三] ...

  3. ngrok服务器搭建_C/C++ Linux 后台服务器开发高级架构师学习知识路线总结

    前言: 小编也是从事c方面10多年的工作经验.今天跟大家分享一下我总结出来的一系列 C/C Linux后台服务器开发的学习路线.从Linux开发工程师-Linux后台开发工程师-Linux高级互联网架 ...

  4. 【Android 逆向】APK 文件处理脚本 ApkTool.py ( 脚本简介 | 用法 | 分析 APK 文件 )

    文章目录 一.APK 文件处理脚本 ApkTool.py 二.ApkTool.py 脚本用法 三.ApkTool.py 脚本分析 APK 输出结果 一.APK 文件处理脚本 ApkTool.py Ap ...

  5. openresty开发系列10--openresty的简单介绍及安装

    openresty开发系列10--openresty的简单介绍及安装 一.Nginx优点 十几年前,互联网没有这么火,软件外包开发,信息化建设,帮助企业做无纸化办公,收银系统,工厂erp,c/s架构偏 ...

  6. 我的Delphi开发经验谈(转)

    --2010年09月28日 星期二 下午 05:26 我的Delphi开发经验谈 -------- 开发环境 -------- Delphi 7是一个很经典的版本,在Win2000/XP下推荐安装De ...

  7. cocos2d-x学习资源汇总(持续更新。。。)

    cnblog子龙山人-------andyque 我之前一直学习c++的,第一次接触cocos2d是oc版的,虽然很好用,但是,我还是对c++情有独钟,再加之cocos2d-x由自己人主导,更应该拥抱 ...

  8. C/C++ Linux 后台服务器开发高级架构师学习知识路线总结

    前言: 小编也是从事c方面10多年的工作经验.今天跟大家分享一下我总结出来的一系列 C/C Linux后台服务器开发的学习路线.从Linux开发工程师-Linux后台开发工程师-Linux高级互联网架 ...

  9. RTTHREAD软件包目录

    RTTHREAD软件包目录 这边统计下RTTHREAD软件包的各项内容 IOT 包名 技术标签 依赖平台 备注 abup_fota OTA TCP/UDP 本软件包是用于 Abup FOTA 升级的固 ...

最新文章

  1. 在同一基准下对前端框架进行比较(2019年更新)
  2. RPC 技术及其框架 Sekiro 在爬虫逆向中的应用,加密数据一把梭
  3. (46)FPGA面试题FPGA内部结构及资源
  4. 验证码识别服务提供商
  5. php阿拉伯语字符串,使用PHP将RTL(阿拉伯语)文本写入图像
  6. 如何在 Windows Server 2003 中配置权威时间服务器
  7. 五种百度云盘下载速度慢解决方法
  8. 静态多层Map缓存清除
  9. 科研入门必备知识之论文种类--Journal、magazine、transactions、proceedings
  10. 随便写的:新戏剧之王,一部广义上的烂片观后感
  11. exoplayer的media2扩展
  12. 11月14日:jquery
  13. 遥控汽车网页小游戏html源码
  14. 调试经验——让Excel开口说话(使用VBA Speak方法让Excel朗读单元格内容)(Let Excel read for you)
  15. my.cnf的常规配置
  16. Winsock中accept函数获取到的ip地址一直为204.204.204.204或0xcccccccc的解决方案
  17. 三维点云学习(6)7-3D Object Detection-KITTI object detection evaluation(2)-kitt 数据集文件分卷解压方式
  18. 68.168.16.153 forum index.php,Discuz1314首页版块N格 带数据缓存功能(study_forum_nge)_Discuz应用中心...
  19. 出来找工作,去创业公司好吗?
  20. 远程视频监控智能工业网关

热门文章

  1. 第五章第四十五题(统计:计算平均值和标准方差)(Statistics: compute mean and standard deviation)
  2. 慕课网Flask高级编程实战-7.静态文件、模板、消息闪现与Jinja2
  3. SQL必知必会挑战题答案
  4. 如何设置主机电脑静态IP地址
  5. 守护网络安全 呵护精神家园 --常见网络风险(二)
  6. 第一天前端学习的内容和心得
  7. 字符串分割(比如按逗号,分号)
  8. 我所玩过的GALGAME——メンアットワーク!魔兽学院men at work2的中文版《永远的羁绊》全攻略...
  9. 埃森哲杯第十六届上海大学程序设计联赛春季赛暨上海高校金马五校赛(A E F )
  10. height、min-height、max-height中听谁的?