크롤링 시 403 에러 해결 방법
본문 바로가기
Language/Python

크롤링 시 403 에러 해결 방법

by 코딩하는 핑가 2025. 6. 11.
반응형

프로젝트한다고 사이트 크롤링하다가 자꾸 403 에러가 났다.

어짜피 저작권때문에 배포하지도 못하는데 차단먹은거 우회하는 방법찾기 위해 쓸데없이 시간 낭비하는게 너무 심해져서 크롤링은 그만 둘 예정이다.

이제 있는 데이터로만 프로젝트 진행할 예정

 

결론만 말하자면 당장 사용해야하는 ip 모두 차단당하긴했음

 

암튼 403 에러 해결을 위해 진행했던 방법

 

해결방법1. undetected_chromedriver 사용

해결방법2. --disable-blink-features=AutomationControlled 사용

- 봇 탐지 우회

options = uc.ChromeOptions()
options.add_argument('--headless')
options.add_argument('--disable-blink-features=AutomationControlled')
options.add_argument('--no-sandbox')
options.add_argument('--disable-dev-shm-usage')
driver = uc.Chrome(options=options)

 

해결방법3. 비봇으로 보이기 위한 서버 차단 방지용 크롤링 간 2~5초 딜레이 로직 추가

time.sleep(random.uniform(2, 5))

 

해결방법4. 병렬 처리

 

해결방법5. DHCP 자동 설정

 

해결방법6. 차단 당한 후 와이파이 재시작한 다음 IP 재할당 받은 뒤 사이트 재접속

 

해결방법7. 프록시 설정

https://www.sslproxies.org/

 

SSL Proxy List | HTTPS Proxy List - Free Proxy List

Free proxies from free-proxy-list.net Updated at 2025-06-11 07:42:02 UTC. 40.76.69.94:8080 37.60.230.40:8888 159.69.57.20:8880 189.240.60.162:9090 189.240.60.166:9090 139.59.34.209:8080 65.108.236.243:8001 188.245.239.104:4001 37.60.230.27:8888 71.14.218.2

www.sslproxies.org

이거 써서 하니까 Cloudflare의 보안 우회 페이지(챌린지 페이지)로 리디렉션 돼서 사용도 못함

 

 

* 전체 코드

https://github.com/sso-jeong/todays-kbo-backend/blob/feature/crawler-schedule/src/main/java/com/kbo/todayskbo/crawler/game/total/Statix_game_summary_producer.py

반응형

댓글