2019. 9. 23.

[python] 웹 크롤링, 네이버 웹툰 제목

from bs4 import BeautifulSoup
from pprint import pprint
import requests

html = requests.get("http://comic.naver.com/webtoon/weekday.nhn")

bsObj = BeautifulSoup(html.text, "html.parser")
#첫번째 가공
date1 = bsObj.find('div',{'class':'col_inner'})
#print(date1)

#두번째 가공

date2 = date1.findAll('a',{"class":"title"})
#print(date2)

for name in date2 :
print(name.get_text())

'''
for name in bsObj.find('div',{'class':'col_inner'}).findAll("a", {"class":"title"}) :
print(name.attrs["title"])
'''

Popular Posts

Recent Posts

Powered by Blogger.