Skip to content

Commit

Permalink
add custom settings to auto recaptcha spider
Browse files Browse the repository at this point in the history
  • Loading branch information
mxsnq committed Jul 26, 2023
1 parent 0887b0d commit 995e960
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions examples/spiders/auto_recaptcha.py
Original file line number Diff line number Diff line change
@@ -1,27 +1,30 @@
import base64

import scrapy
from twisted.python.failure import Failure

from scrapypuppeteer import PuppeteerRequest
from scrapypuppeteer.actions import GoTo, Screenshot
from scrapypuppeteer.response import PuppeteerResponse, PuppeteerScreenshotResponse

import base64


class AutoRecaptchaSpider(scrapy.Spider):
"""
Current settings for RecaptchaMiddleware:
RECAPTCHA_ACTIVATION = True
RECAPTCHA_SOLVING = True
RECAPTCHA_SUBMIT_SELECTORS = {
'www.google.com/recaptcha/api2/demo': '#recaptcha-demo-submit',
}
"""

name = "auto_recaptcha"

start_urls = ["https://www.google.com/recaptcha/api2/demo"]

custom_settings = {
'DOWNLOADER_MIDDLEWARES': {
'scrapypuppeteer.middleware.PuppeteerRecaptchaDownloaderMiddleware': 1041,
'scrapypuppeteer.middleware.PuppeteerServiceDownloaderMiddleware': 1042
},
'RECAPTCHA_ACTIVATION': True,
'RECAPTCHA_SOLVING': True,
'RECAPTCHA_SUBMIT_SELECTORS': {
'www.google.com/recaptcha/api2/demo': '#recaptcha-demo-submit',
}
}

def start_requests(self):
for url in self.start_urls:
action = GoTo(url=url)
Expand Down

0 comments on commit 995e960

Please sign in to comment.