[Python] Need Help Fixing My F’d Up Code – (2Captcha API)

I'm trying to scrape the captcha image and sent it to the 2Captcha API

What the code below does:

  • Scrapes source code from pingler
  • Identifies and scrapes a URL with "api-secure.mediasolve" in it (captcha load URL)
  • Disables javascript and opens browser
  • Visits the captcha page (only loads when JS is disabled)
  • Takes a screenshot
  • Crops the image
  • Saves the image

[Python] Need Help Fixing My F'd Up Code – (2Captcha API)