크롤링 중 데이터를 받아오지 못할 때.
- user-agent, referrer
- cookies
- auth, authorization 등 권한의미 포함 값
- 전부 다
import json
import requests
url = 'https://comic.naver.com//comment/comment?titleId=783053&no=52'
# 1. user-agent, referrer
headers = {
'User-Agent' : 'Mozilla/5.0 (Windows NT 10.0;Win64; x64)\AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98\Safari/537.36'
, 'referer': 'https://comic.naver.com//comment/comment?titleId=783053&no=52'
}
resp = requests.get(url, headers=headers)
resp.content
References
https://cceeddcc.tistory.com/5
728x90
반응형
'개발' 카테고리의 다른 글
TF-IDF (0) | 2022.11.03 |
---|---|
BoW (Bag of Words) (0) | 2022.11.03 |
c# telegram channel 에서 bot으로 알림 보내기 (0) | 2022.02.28 |
c# telegrambot api (0) | 2022.02.28 |
visual studio code c++ setting on mac (0) | 2022.02.10 |