V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
eromoe
V2EX  ›  Python

有人研究过用 python 调用迅雷客户端 API 新建种子任务的方法么?(非迅雷离线)

  •  
  •   eromoe · 2016-05-01 21:21:18 +08:00 · 10929 次点击
    这是一个创建于 2906 天前的主题,其中的信息可能已经有所发展或是发生改变。
    迅雷文档: http://xldoc.xl7.xunlei.com/0000000026/index.html

    网上的例子全都是 2010 年左右的,而且只有普通下载

    Set ThunderAgent = CreateObject("ThunderAgent.Agent.1")
    Call ThunderAgent.AddTask("http://www.jb51.net/files/bjhyn.mp3","北京欢迎你.mp3","c:\a\","","http://www.readlog.cn",1,0,5)
    Call ThunderAgent.CommitTasks2(1)
    Call ThunderAgent.AddTask("http://file.fzone.cn/upload2/hompyFile/2007/28/921524670987.wma","放羊的星星.wma","c:\a\b\c\","",http://www.jb51.net,1,0,5)
    Call ThunderAgent.CommitTasks2(1)


    改成 python 版的是

    a = com.Dispatch('ThunderAgent.Agent.1')
    path = 'http://www.xxx.com/1.torrent'
    a.AddTask(path,'1.torrent','c:\\','','',1,0,5)
    a.CommitTasks2(1)


    用 python 可以调用 CommitTasks2 (有新建任务弹窗,不知道怎么用程序点确认下载。。。,这也是个问题)
    最重要的是没办法调用 CommitBTTasks 。。。。。


    真心求破
    第 1 条附言  ·  2016-05-02 00:26:03 +08:00
    迅雷文档结构:
    http://xldoc.xl7.xunlei.com/0000000024/index.html

    Thunder7
    Thunder
    MainWnd
    Plugin
    PluginPlatform
    AddinManagerHelper
    TaskInfoPanel
    InsertUserTable
    SetConfigCallback
    xunlei
    TaskFactory
    CreateBTTask (这个无法调用,目的就是要调用这个接口,还要能指定文件夹名。。。)
    CreateTask (无法调用,不过 2 可以)
    CreateTask2 (只能调 http , 而且有弹出确认框)
    8 条回复    2017-02-10 13:54:01 +08:00
    mzcyx2011
        1
    mzcyx2011  
       2016-05-01 22:24:30 +08:00
    # -*- coding=utf-8 -*-
    import os
    import time
    from win32com.client import Dispatch
    def addTasktoXunlei(down_url,course_infos):
    flag = False
    o = Dispatch("ThunderAgent.Agent.1")
    if down_url:
    course_path = os.getcwd()
    try:
    #AddTask("下载地址", "另存文件名", "保存目录","任务注释","引用地址","开始模式", "只从原始地址下载","从原始地址下载线程数")
    o.AddTask(down_url, '', course_path, "", "", -1, 0, 5)
    o.CommitTasks()
    flag = True
    except Exception:
    print(Exception.message)
    print(" AddTask is fail!")
    return flag
    我也找过很久,最后找到的这个!!运行前要把迅雷设置为静默下载,这样就不用点击确认再下载
    mzcyx2011
        2
    mzcyx2011  
       2016-05-01 22:25:47 +08:00
    上面的代码复制过去就没格式了,自己修改吧
    jsl
        3
    jsl  
       2016-05-01 23:15:58 +08:00
    libtorrent 提供 python 接口
    eromoe
        4
    eromoe  
    OP
       2016-05-02 00:12:25 +08:00
    @mzcyx2011
    这个就是我贴的那种方式啦。。。只能下 HTTP 的,无法新建 bt 种子任务啊,我想新建任务同时制定一个文件夹
    而且迅雷极速版 没有静默下载。。。。
    @jsl
    我在自己机子上下载,用命令行下 bt 真的很麻烦,迅雷管理任务什么也比较方便,有些任务要挂好几个星期呢。。。想换个源的时候就可以自己手动删除, libtorrent 这些肯定都不行吧
    ipcjs
        5
    ipcjs  
       2016-11-04 22:48:53 +08:00
    @eromoe 有没有找到更好的方式?
    ipcjs
        6
    ipcjs  
       2016-11-13 18:09:20 +08:00
    直接启动 Thunder.exe ,把.torrent 文件传过去,同时开启一个 AHK 脚本,用来点“立即下载”。效果不错,你们可以试试(;¬_¬)
    eromoe
        7
    eromoe  
    OP
       2016-12-29 11:04:37 +08:00
    @ipcjs 你这就变成 UI 脚本了啊。。。。要控制鼠标的,万一我在用电脑咋办。。。
    ipcjs
        8
    ipcjs  
       2017-02-10 13:54:01 +08:00 via Android
    @eromoe 不会有什么影响点立即下载很快的,顶多闪一下。
    我是用来下自动下动画的,一星期才下几集,有的时候还是晚上检测到更新~
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   4350 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 05:30 · PVG 13:30 · LAX 22:30 · JFK 01:30
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.