Closed thecoolreaver closed 1 year ago
doing a test via python cloudscraper
import cloudscraper
scraper = cloudscraper.create_scraper(delay=10, browser="chrome")
content = scraper.get("https://www.furaffinity.net/").text
print(content)
returns this
cloudscraper.exceptions.CloudflareChallengeError: Detected a Cloudflare version 2 Captcha challenge, This feature is not available in the opensource (free) version.
Rerunning the test now shows its fine. Back to normal? Ill leave this open for the moment but you may close if needed
I am aware of the issue and have already tried using cfscrape with no success.
As soon as I find a solution I’ll update the library/add a comment here :)
Rerunning the test now shows it’s fine. Back to normal? Ill leave this open for the moment but you may close if needed
@thecoolreaver Did you perchance use the same cookies in a login session you use on your browser? This same issue happened before and the “fix” last time was to simply open the page in a browser so cloudflare would clear those particular cookies.
No I did not, I have a separate account and this is ran on a different ISP.
The tests were just python's requests and cloudscraper going direct to the main site to test cloudflare's Captcha response which did not include any login cookies or sessions at that time.
Fixed it!
As I suspected, using the cookies in a browser solves the issue and clears the cookies.
Alternatively, new cookies can be created with a new login session.
Using cloudscraper or cfscrape is not necessary (not useful as we saw). Once the cookies are cleared they can be used with a normal requests.Session
object, and as long as those cookies are added to the session's cookie jar, then all requests will succeed :)
Ok
I will drop this code I did find for future ref in case the option of having to switch is needed. This will probably not be the best as it requires a chromium browser to be installed so it can be ran headless but this does get around the v2 Cloudflare Captcha
from selenium.webdriver.support.wait import WebDriverWait
import selenium.webdriver.support.expected_conditions as EC
from selenium.common.exceptions import TimeoutException
import undetected_chromedriver as uc
driver = uc.Chrome(headless=True,use_subprocess=False)
driver.get('https://www.furaffinity.net/')
print('current url %s' % driver.current_url)
try:
WebDriverWait(driver,15).until(EC.title_contains('moment'))
except TimeoutException:
pass
print('current url %s' % driver.current_url)
try:
WebDriverWait(driver,15).until(EC.title_contains('Affinity'))
print('PASSED CLOUDFLARE!')
except TimeoutException:
print('timeout')
print('current url %s' % driver.current_url)
print(driver.page_source)
driver.quit
Thanks for sharing!
I am actually testing Selenium for falocalrepo to simplify the login process for users who aren’t so versed with cli tools and browsers’ inspection tools.
Version
falocalrepo 4.4.5
What happened?
Cloudflare has enabled new checkers which prevent
How to reproduce the bug?
attempt to run program and returns cloudflare check error
Relevant log output