ad-m / python-anticaptcha

Client library for solve captchas with Anticaptcha.com support.
http://python-anticaptcha.readthedocs.io/en/latest/
MIT License
223 stars 51 forks source link

Passing Image from URL to ImageToTextTask #43

Closed MacMarde closed 5 years ago

MacMarde commented 5 years ago

I need to solve a text captcha. The image can be found in an URL. It appears while signing up to Microsoft Bing rewards over this link: https://login.live.com/

Image URL example (not valid): https://scu.client.hip.live.com/GetHIPData?hid=SCU.7d4fbbb987354a1fa58dfbf33241b8fb&fid=1c16cac9d7d3295f93438e50d37c13ed&id=15041&type=visual&cs=HIPAMFE

How can I pass the image from URL to the ImageToTextTask(captcha_fp)

Normally this function takes a file pointer (I guess) like this:

captcha_fp = open('examples/captcha_ms.jpeg', 'rb') client = AnticaptchaClient(api_key) task = ImageToTextTask(captcha_fp)

Is there a way to pass the image directly to the ImageToTextTask(captcha_fp) ?

ad-m commented 5 years ago

Hello,

Workers must have access to the image to correctly solve the task. In many cases, sending an image is not enough (session, IP address of users etc.) to successfully access an identical image. In your case, even if you can download the picture, there is a risk that the account will be flagged as a suspicious activity and you will not achieve your goals.

I recommend you to forward that image in requests. I added example for that here: https://github.com/ad-m/python-anticaptcha/blob/master/examples/remote_image.py

You can also use custom captcha task which accept URL. Example is here: https://github.com/ad-m/python-anticaptcha/blob/master/examples/custom_dot.py

Greetings,

MacMarde commented 5 years ago

I can download the captcha with python. What is the moste secure way now to not get flagged?

  1. Download the image temporarily with python and send it with ImageToTextTask(captcha_fp) ? OR
  2. Forwarding with requests and ImageToTextTask(captcha_fp) OR
  3. Use custom captcha task and send URL ??

I believe 3. is not save, because they detect a worker with another session and IP is accessing the image.

What do you think is savest Adam?

ad-m commented 5 years ago

Solution 1 and 2 work in a similar way, if you pass identical cookies etc. They are similarly safe if you use the same Session instance.

MacMarde commented 5 years ago

Its working like a charm. Thank you Adam.

ad-m commented 5 years ago

Is there anything do you need help? Could you close that issue?