인프런 영문 브랜드 로고
인프런 영문 브랜드 로고

Inflearn Community Q&A

inkservice20661's profile image
inkservice20661

asked

Introduction to Python and Creating Various Automated Applications Using Web Crawling

How to use BeautifulSoup and Simple Web Parsing Practice (1) - Naver, Daum, Inflearn

다음 금융사이트 크롤링 문제가 발생이 되서 안되네요

Written on

·

454

0

안녕하세요

강의 잘 듣고 있습니다.

다음 금융사이트 크롤링을 했는데 뭐가문제인지 에러는 없고 체크표시되서 나오고

[Finished in 0.574s]라고 결과가 나오는데

결과물은 전혀 안나오네요.

뭐가 문제일까요?

from bs4 import BeautifulSoup

import urllib.request as req

import sys

import io

sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')

sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')

url = "http://finance.daum.net/"

res = req.urlopen(url).read()

soup = BeautifulSoup(res, "html.parser")

top = soup.select("#boxTopSearchs > li > a")

for i,e in enumerate(top,1):

print(i,e.find("a").string)

python웹-크롤링

Answer 2

1

niceman님의 프로필 이미지
niceman
Instructor

네 안녕하세요.

다음 금융사이트 현재 방식이 바뀌었습니다.

강의 하단에 보시면 새로운 소스를 올려놨습니다.

크롤링 특성상 소스가 변경되는 경우가 잦습니다.

지금 변경된 다음사이트 크롤링 예제입니다.

주석 꼼꼼히 보시면 설치해야할 패키지도 있으니 확인 잘 부탁드립니다.

https://github.com/eunki7/python_create_app_1/blob/master/section2/2-7-1_new_1.py

0

소스 참고해서 공부해보겠습니다. 감사합니다 ^^

inkservice20661's profile image
inkservice20661

asked

Ask a question