|
|
本帖最后由 Syc 于 2020-8-2 17:07 编辑
[ol]本文来源:https://php.wf/archives/remote-download-by-controlling-xunlei-with-com-object.html[/ol]复制代码
IE时代,迅雷下载会在IE中注册并加载COM控件ThunderAgent.dll,使用Js调起对象ThunderAgent.Agent实现添加下载任务。
以下为官方JS调用函数,其他语言只要能链接COM库的,均参照此函数构建即可。
希望MJJ构建离线下载机的时候,不要只用aria2,也可以用Xunlei撸一撸。
唠叨:
GetInfo 获取迅雷状态,
AddTask 添加任务,
CommitTaskss 开始任务,
CancelTasks 取消任务,
GetTaskInfoStruct 任务状态查询(进度等)
[ol]function AddLink(Url,Info,Location,strCID,strStatUrl,strCookie,strCharset){if (Url != ""){ if (Info == "") { Info = "unknown"; } try { var ThunderAgent = new ActiveXObject("ThunderAgent.Agent"); } catch(e) { ThunderAgent = new ActiveXObject("ThunderAgent.Agent64"); } try { ThunderAgent.AddTask12(Url, "", "", Info, Location, strCharset, -1, 0, -1, strCookie, strCID, strStatUrl, 0, "rightup"); } catch(e) { try { ThunderAgent.AddTask5(Url, "", "", Info, Location, -1, 0, -1, strCookie, strCID, strStatUrl, 1, "", -1); } catch(e) { ThunderAgent.AddTask2(Url, "", "", Info, Location, -1, 0, -1, strCookie); } } ThunderAgent.CommitTasks2(1);}}[/ol]复制代码


|
|