Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bypass cloudflare is not woriking #9

Open
yuke2002 opened this issue Aug 1, 2024 · 1 comment
Open

Bypass cloudflare is not woriking #9

yuke2002 opened this issue Aug 1, 2024 · 1 comment

Comments

@yuke2002
Copy link

yuke2002 commented Aug 1, 2024

from botasaurus_driver import Driver

driver = Driver()
driver.google_get("https://www.g2.com/products/github/reviews.html?page=5&product_id=github", bypass_cloudflare=True)
driver.prompt()
heading = driver.get_text('.product-head__title [itemprop="name"]')
print(heading)

in this code the bypass cloudflare take about to 40mins but still cloudflare was not bypassed

@yuke2002
Copy link
Author

yuke2002 commented Aug 1, 2024

I am getting this error


ChromeException Traceback (most recent call last)
Cell In[4], line 4
1 from botasaurus_driver import Driver
3 driver = Driver()
----> 4 driver.google_get("https://www.g2.com/products/github/reviews.html?page=5&product_id=github", bypass_cloudflare=True)
5 driver.prompt()
6 heading = driver.get_text('.h1')

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\driver.py:536, in DriverBase.google_get(self, link, bypass_cloudflare, wait, accept_google_cookies)
534 self.get("https://www.google.com/")
535 perform_accept_google_cookies_action(self)
--> 536 self.get_via(link, "https://www.google.com/", bypass_cloudflare=bypass_cloudflare, wait=wait)

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\driver.py:522, in DriverBase.get_via(self, link, referer, bypass_cloudflare, wait)
519 wait_till_document_is_ready(self._tab, self.config.wait_for_complete_page_load)
521 if bypass_cloudflare:
--> 522 self.detect_and_bypass_cloudflare()
523 block_if_should(self)

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\driver.py:879, in DriverBase.detect_and_bypass_cloudflare(self)
878 def detect_and_bypass_cloudflare(self) -> None:
--> 879 bypass_if_detected(self)

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\solve_cloudflare_captcha.py:198, in bypass_if_detected(driver)
196 solve_full_cf(driver)
197 else:
--> 198 solve_widget_cf(driver)

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\solve_cloudflare_captcha.py:169, in solve_widget_cf(driver)
168 def solve_widget_cf(driver):
--> 169 iframe = wait_for_widget_iframe(driver)
171 WAIT_TIME = 16
172 start_time = time()

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\solve_cloudflare_captcha.py:128, in wait_for_widget_iframe(driver)
126 while not iframe:
127 sleep(1)
--> 128 iframe = get_widget_iframe(driver)
129 return iframe

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\solve_cloudflare_captcha.py:122, in get_widget_iframe(driver)
121 def get_widget_iframe(driver):
--> 122 return driver.select('[title="Widget containing a Cloudflare security challenge"]', None)

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\driver.py:569, in DriverBase.select(self, selector, wait)
568 def select(self, selector: str, wait: Optional[int] = Wait.SHORT) -> Element:
--> 569 elem = self._run(self._tab.select(selector, timeout=wait))
570 return make_element(self, self._tab, elem) if elem else None

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\core\tab.py:243, in Tab.select(self, selector, timeout, _node)
230 """
231 find single element by css selector.
232 can also be used to wait for such element to appear.
(...)
239
240 """
241 now = time.time()
--> 243 item = self.query_selector(selector, _node)
244 if timeout:
245 while not item:

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\core\tab.py:403, in Tab.query_selector(self, selector, _node)
401 raise DriverException("Failed to find Document")
402 try:
--> 403 node_id = self.send(cdp.dom.query_selector(doc.node_id, selector))
405 except ChromeException as e:
406 if _node is not None:

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\core\connection.py:248, in Connection.send(self, cdp_obj, _is_update)
244 raise
247 result = wait_till_response_arrives(self.queue, tx_id , 40)
--> 248 result = parse_response(result, cdp_obj)
250 return result

File c:\Users\YukendiranJ\AppData\Local\Programs\Python\Python312\Lib\site-packages\botasaurus_driver\core\connection.py:45, in parse_response(response, cdp_obj)
42 def parse_response(response, cdp_obj):
43 if "error" in response:
44 # set exception and bail out
---> 45 raise ChromeException(response["error"])
46 try:
47 # try to parse the result according to the py cdp docs.
48 return cdp_obj.send(response["result"])

ChromeException: Could not find node with given id [code: -32000]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant