在python中使用IDM(Internet Download Manager)API

时间:2014-03-23 06:10:25

标签: python com

我正在尝试通过python使用IDM api,但我完全迷失了我将如何做到这一点。 http://www.internetdownloadmanager.com/support/idm_api.html

有人可以帮帮我吗? 我甚至不知道是否可以用python做到这一点。

1 个答案:

答案 0 :(得分:3)

IDM api似乎可以从Visual Basic访问,这很好,因为它意味着它支持IDispatch,因此支持Python。您想使用comtypes库。使用VB sample作为原型:

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)
相关问题