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 : 145 Date : 2024/08/13 04:50
|