@@ -92,6 +92,13 @@ def from_crawler(cls, crawler):
92
92
cls .window_height = settings .get ('GERAPY_PYPPETEER_WINDOW_HEIGHT' , GERAPY_PYPPETEER_WINDOW_HEIGHT )
93
93
cls .headless = settings .get ('GERAPY_PYPPETEER_HEADLESS' , GERAPY_PYPPETEER_HEADLESS )
94
94
cls .dumpio = settings .get ('GERAPY_PYPPETEER_DUMPIO' , GERAPY_PYPPETEER_DUMPIO )
95
+ cls .ignore_https_errors = settings .get ('GERAPY_PYPPETEER_IGNORE_HTTPS_ERRORS' , GERAPY_PYPPETEER_IGNORE_HTTPS_ERRORS )
96
+ cls .slow_mo = settings .get ('GERAPY_PYPPETEER_SLOW_MO' , GERAPY_PYPPETEER_SLOW_MO )
97
+ cls .ignore_default_args = settings .get ('GERAPY_PYPPETEER_IGNORE_DEFAULT_ARGS' , GERAPY_PYPPETEER_IGNORE_DEFAULT_ARGS )
98
+ cls .handle_sigint = settings .get ('GERAPY_PYPPETEER_HANDLE_SIGINT' , GERAPY_PYPPETEER_HANDLE_SIGINT )
99
+ cls .handle_sigterm = settings .get ('GERAPY_PYPPETEER_HANDLE_SIGTERM' , GERAPY_PYPPETEER_HANDLE_SIGTERM )
100
+ cls .handle_sighup = settings .get ('GERAPY_PYPPETEER_HANDLE_SIGHUP' , GERAPY_PYPPETEER_HANDLE_SIGHUP )
101
+ cls .auto_close = settings .get ('GERAPY_PYPPETEER_AUTO_CLOSE' , GERAPY_PYPPETEER_AUTO_CLOSE )
95
102
cls .devtools = settings .get ('GERAPY_PYPPETEER_DEVTOOLS' , GERAPY_PYPPETEER_DEVTOOLS )
96
103
cls .executable_path = settings .get ('GERAPY_PYPPETEER_EXECUTABLE_PATH' , GERAPY_PYPPETEER_EXECUTABLE_PATH )
97
104
cls .disable_extensions = settings .get ('GERAPY_PYPPETEER_DISABLE_EXTENSIONS' ,
@@ -128,13 +135,34 @@ async def _process_request(self, request: PyppeteerRequest, spider):
128
135
f'--window-size={ self .window_width } ,{ self .window_height } ' ,
129
136
]
130
137
}
131
- if self .executable_path : options ['executable_path' ] = self .executable_path
132
- if self .disable_extensions : options ['args' ].append ('--disable-extensions' )
133
- if self .hide_scrollbars : options ['args' ].append ('--hide-scrollbars' )
134
- if self .mute_audio : options ['args' ].append ('--mute-audio' )
135
- if self .no_sandbox : options ['args' ].append ('--no-sandbox' )
136
- if self .disable_setuid_sandbox : options ['args' ].append ('--disable-setuid-sandbox' )
137
- if self .disable_gpu : options ['args' ].append ('--disable-gpu' )
138
+ if self .executable_path :
139
+ options ['executable_path' ] = self .executable_path
140
+ if self .ignore_https_errors :
141
+ options ['ignoreHTTPSErrors' ] = self .ignore_https_errors
142
+ if self .slow_mo :
143
+ options ['slowMo' ] = self .slow_mo
144
+ if self .ignore_default_args :
145
+ options ['ignoreDefaultArgs' ] = self .ignore_default_args
146
+ if self .handle_sigint :
147
+ options ['handleSIGINT' ] = self .handle_sigint
148
+ if self .handle_sigterm :
149
+ options ['handleSIGTERM' ] = self .handle_sigterm
150
+ if self .handle_sighup :
151
+ options ['handleSIGHUP' ] = self .handle_sighup
152
+ if self .auto_close :
153
+ options ['autoClose' ] = self .auto_close
154
+ if self .disable_extensions :
155
+ options ['args' ].append ('--disable-extensions' )
156
+ if self .hide_scrollbars :
157
+ options ['args' ].append ('--hide-scrollbars' )
158
+ if self .mute_audio :
159
+ options ['args' ].append ('--mute-audio' )
160
+ if self .no_sandbox :
161
+ options ['args' ].append ('--no-sandbox' )
162
+ if self .disable_setuid_sandbox :
163
+ options ['args' ].append ('--disable-setuid-sandbox' )
164
+ if self .disable_gpu :
165
+ options ['args' ].append ('--disable-gpu' )
138
166
139
167
# set proxy
140
168
proxy = request .proxy
0 commit comments