로그인

  • 목록
  • 아래로
  • 위로
  • 쓰기
  • 검색

정보&강의 python requests 요청시 cloudflare 5xx-error-landing 에러 해결법


파이썬으로 크롤링을 할 경우, 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')

 

이 방법인 셀레니옴의 기능까지 대체를 해줄 수 있습니다.

 


이런 글도 찾아보세요!

공유

facebooktwitterpinterestbandkakao story
퍼머링크

댓글 0

권한이 없습니다. 로그인

신고

"님의 댓글"

이 댓글을 신고 하시겠습니까?

삭제

"님의 댓글"

이 댓글을 삭제하시겠습니까?