반응형
웹페이지 접속은 되는데, 503 에러가 계속 뜰때
ex). remoteok.io
그 페이지에서 스크랩 방지를 걸어놓은 것이다
해결방법
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',}
r = requests.post(url, headers=headers)
r.raise_for_status()
def export_remote_jobs():
word = 'python'
SEARCH_URL = f"https://remoteok.io/remote-dev+{word}-jobs?hide_sticky=&compact_mode=true&location=anywhere"
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.36',}
r = requests.post(SEARCH_URL, headers=headers)
r.raise_for_status()
print(r.status_code)
soup = BeautifulSoup(r.text,'html.parser')
get_jobs(soup)
반응형
'Web > crawling' 카테고리의 다른 글
파이썬 beautifulsoup 주요 속성 (0) | 2021.09.08 |
---|---|
crawling) 웹페이지 html 로 불러오기 (0) | 2021.03.28 |
crawling) pdf 파일 생성 (0) | 2021.03.28 |
crawling) puppeteer 스크린샷 (0) | 2021.03.28 |