问题
I am trying to use the IDM api through python but I'm completely lost on how i would do this. http://www.internetdownloadmanager.com/support/idm_api.html
Could someone please help me? I don't even know if it is possible to do this with python.
回答1:
The IDM api seems to be accessible from Visual Basic, which is good, because it means that it supports IDispatch and therefore Python. You want to use the comtypes library. Using the VB sample as a prototype:
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)
来源:https://stackoverflow.com/questions/22587681/use-idminternet-download-manager-api-with-python