在python中使用IDM(Internet下载管理器)API

在python中使用IDM(Internet下载管理器)API,python,com,Python,Com,我正试图通过python使用IDMAPI,但我完全不知道如何做到这一点。 谁能帮帮我吗? 我甚至不知道是否可以用python实现这一点。IDMAPI似乎可以从Visual Basic访问,这很好,因为这意味着它支持IDispatch,从而支持python。你想使用图书馆。使用作为原型: import comtypes.client as cc import comtypes referrer = "" cookie = "" postData = "" user = "" password

我正试图通过python使用IDMAPI,但我完全不知道如何做到这一点。

谁能帮帮我吗?
我甚至不知道是否可以用python实现这一点。

IDMAPI似乎可以从Visual Basic访问,这很好,因为这意味着它支持IDispatch,从而支持python。你想使用图书馆。使用作为原型:

import comtypes.client as cc
import comtypes

referrer = ""
cookie = ""
postData = ""
user = ""
password = ""
cc.GetModule(["{PUT_UUID_HERE}",1,0])
# not sure about the syntax here, but cc.GetModule will tell you the name of the wrapper it generated
import comtypes.gen.IDManLib as IDMan
idm1 = cc.CreateObject("IDMan.CIDMLinkTransmitter", None, None, IDMan.ICIDMLinkTransmitter2)
idm1.SendLinkToIDM("http://www.internetdownloadmanager.com/idman401.exe",
referrer, cookie, postData, user, password, r"C:\\", "idman401.exe", 0)

IDMAPI似乎可以从Visual Basic中访问,这很好,因为这意味着它支持IDispatch,因此支持Python。你想使用图书馆。使用作为原型:

import comtypes.client as cc
import comtypes

referrer = ""
cookie = ""
postData = ""
user = ""
password = ""
cc.GetModule(["{PUT_UUID_HERE}",1,0])
# not sure about the syntax here, but cc.GetModule will tell you the name of the wrapper it generated
import comtypes.gen.IDManLib as IDMan
idm1 = cc.CreateObject("IDMan.CIDMLinkTransmitter", None, None, IDMan.ICIDMLinkTransmitter2)
idm1.SendLinkToIDM("http://www.internetdownloadmanager.com/idman401.exe",
referrer, cookie, postData, user, password, r"C:\\", "idman401.exe", 0)

这里有一个类似的帖子来提示。这里有一个类似的帖子来提示。我尝试了你的解决方案,但我犯了这个错误。回溯(最近一次调用):idm1.SendLinkToIDM中的文件“test.py”,第11行(“errer,cookie,postData,user,password,“C:\\”,“idman401.exe”,0)AttributeError:'指针(IUnknown)'object没有属性'SendLinkToIDM'@Ramis修复了使用typelibs.Awesome的答案。非常感谢!!!我确实做了一些小改动,但效果很好。:)只需提到,最好使用UUID加载模块:
idm=cc.GetModule(['{ECF21EAB-3AA8-4355-82BE-F777990001DD}',1,0])
。可以通过搜索tlb文件名在Windows注册表编辑器中找到UUID。知道如何将数据传递给SendLinksArray吗?我尝试了您的解决方案,但出现了此错误。回溯(最近一次调用):idm1.SendLinkToIDM中的文件“test.py”,第11行(“errer,cookie,postData,user,password,“C:\\”,“idman401.exe”,0)AttributeError:“指针(IUnknown)”对象没有“SendLinkToIDM”属性@Ramis修复了使用typelibs.Awesome的答案。非常感谢!!!我确实需要做一些小改动,但效果很好。:)只需提及,最好使用UUID加载模块:
idm=cc.GetModule([{ECF21EAB-3AA8-4355-82BE-F777990001DD}',1,0])
。通过搜索tlb文件名,可以在Windows注册表编辑器中找到UUID。知道如何将数据传递到SendLinksArray吗?