46_PYTHON 크롤러 개발: 크롤링할 사이트 분석
크롤링(crawling)
- 웹 상에 데이터를 긁어 모으는 작업
크롤러 패키지
- requests: 웹 자원을 요청하기 위한 라이브러리
- bs4: 가지고 온 html 코드를 파싱하기 위한 라이브러리
크롤러 개발 단계
- 개발자 도구를 통해 웹 사이트 분석
- 크롤링 코드 작성
- 파일 저장 및 데이터 분석
파싱까지 실행
- 실행 결과: 터미널에 twitch 웹 페이지의 html 코드가 출력됨
크롤러 패키지 - requests: 웹 자원을 요청하기 위한 라이브러리 - bs4: 가지고 온 html 코드를 파싱하기 위한 라이브러리
크롤러 개발 단계 - 개발자 도구를 통해 웹 사이트 분석 - 크롤링 코드 작성 - 파일 저장 및 데이터 분석
파싱까지 실행 - 실행 결과: 터미널에 twitch 웹 페이지의 html 코드가 출력됨
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup as bs | |
URL = "https://www.twitch.tv/" | |
rq = requests.get(URL) | |
soup = bs(rq.content, 'html.parser') | |
print(soup) |
댓글남기기