# 네이버 시리즈 Ebook Top 100 수집기
import requests
from bs4 import BeautifulSoup
for n in range(1,6):
raw = requests.get("https://series.naver.com/ebook/top100List.nhn?page="+str(n),
headers = {'User-Agent':'Mozilla/5.0'})
html = BeautifulSoup(raw.text, "html.parser")
ranking = html.select("div.lst_thum_wrap li")
for ra in ranking:
num = int(ra.select_one("span.num").text.strip())
title = ra.select_one("a strong").text.strip()
writer = ra.select_one("span.writer").text.strip()
price = int(ra.select_one("p.price2").text.strip().replace("구매\n","").replace(",","").replace("원",""))
data = (num, title, writer, price)
print(data)
https://book.coalastudy.com/data_crawling/
데이터 수집기 예제
네이버시리즈 Ebook Top 100
아직은 태그 내에서 같은 값이 여러 개
즉 원래 가격과 할인 가격이 동시에 들어가 있는 경우에는
구분을 어떻게 해야 할지 모르겠습니다.
천천히 배워나가야죠.
맘 편하게 재미있게 하다 보면 어느 정도 올라갈 거라고 생각합니다.
'코딩' 카테고리의 다른 글
나총무 - 내가총무다 (0) | 2021.06.23 |
---|---|
python - 데이터수집기, 엑셀 저장 (0) | 2021.05.16 |
python - Scraping 도전중 (0) | 2021.05.12 |
python 기초 - 쉬운게 없다. (0) | 2021.05.10 |
Udacity - Intro to Computer Science (0) | 2021.04.30 |