Skip to content

Commit fb7088a

Browse files
hannsenmmarquezs
hannsen
authored andcommitted
Add captcha interface
1 parent ab86fcd commit fb7088a

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

myjdapi/myjdapi.py

+31
Original file line numberDiff line numberDiff line change
@@ -613,6 +613,36 @@ def force_download(self, link_ids=[], package_ids=[]):
613613
resp = self.device.action(self.url + "/forceDownload", params)
614614
return resp
615615

616+
class Captcha:
617+
"""
618+
Class that represents the captcha interface of a Device
619+
"""
620+
621+
def __init__(self, device):
622+
self.device = device
623+
self.url = "/captcha"
624+
625+
"""
626+
Get the waiting captchas
627+
"""
628+
def list(self):
629+
resp = self.device.action(self.url + "/list", [])
630+
return resp
631+
632+
"""
633+
Get the base64 captcha image
634+
"""
635+
def get(self, captcha_id):
636+
resp = self.device.action(self.url + "/get", (captcha_id,))
637+
return resp
638+
639+
"""
640+
Solve a captcha
641+
"""
642+
def solve(self, captcha_id, solution):
643+
resp = self.device.action(self.url + "/solve", (captcha_id, solution))
644+
return resp
645+
616646

617647
class Jddevice:
618648
"""
@@ -630,6 +660,7 @@ def __init__(self, jd, device_dict):
630660
self.device_type = device_dict["type"]
631661
self.myjd = jd
632662
self.linkgrabber = Linkgrabber(self)
663+
self.captcha = Captcha(self)
633664
self.downloads = Downloads(self)
634665
self.toolbar = Toolbar(self)
635666
self.downloadcontroller = DownloadController(self)

0 commit comments

Comments
 (0)