|
http://www.hackerschool.org/HS_Boards/zboard.php?id=Free_Lectures&no=8581 [복사]
from bs4 import BeautifulSoup
import requests
url = "http://finance.naver.com/item/main.nhn?code=000660"
html = requests.get(url).text
# HTML 출력하여 페이지 구조 확인
print(html)
soup = BeautifulSoup(html, "html.parser")
# 'tags' 리스트가 비어있는지 확인
tags = soup.select("#_per")
if not tags:
print("No elements found with the given selector.")
else:
tag = tags[0]
print(tag.text)
웹 크롤링(Web Crawling)은 웹 페이지에서
정보를 자동으로 수집하는 프로세스를 의미한다.
이는 주로 프로그램이나 스크립트를 통해 수행되며,
웹 페이지의 콘텐츠를 다운로드하고,
필요한 데이터를 추출하여 저장하는 과정을 포함한다. |
Hit : 2388 Date : 2024/08/13 04:50
|