정보&강의 python requests 요청시 cloudflare 5xx-error-landing 에러 해결법
- 운영자
- 343
- 0
파이썬으로 크롤링을 할 경우, 5xx-error-landing 에러가 발생할 경우가 있습니다.
이를 해결하기 위해 cloudscraper 모듈을 사용하면 간단하게 에러를 해결할 수 있습니다.
사용법은 아래와 같습니다.
import cloudscraper from bs4 import BeautifulSoup import re def get_proxy_list(): url = 'https://spys.one/en/free-proxy-list/' scraper = cloudscraper.create_scraper(browser={'browser': 'firefox','platform': 'windows','mobile': False}) html = scraper.get(url).content soup = BeautifulSoup(html, 'html.parser')
이 방법인 셀레니옴의 기능까지 대체를 해줄 수 있습니다.
이런 글도 찾아보세요!
댓글 0
권한이 없습니다. 로그인