하고재비

[PYTHON] 크롤링 본문

Python

[PYTHON] 크롤링

DeadDE 2017. 12. 8. 16:30
from urllib.request import urlopen
from bs4 import BeautifulSoup

for i in range(26600, 26630):
URL = 'http://www.inven.co.kr/board/overwatch/4676/' + str(i)
html = urlopen(URL)
soup = BeautifulSoup(html, 'lxml')
contents_1 = soup.find_all('div',{'class':'articleCategory'})
if len(contents_1) != 0:
if "[영웅]" in contents_1[0].get_text():
contents = soup.find_all('div', {"class": "articleTitle"})
print(str(i) + "번 게시물 : " + contents[0].get_text() + " 카테고리 : " + contents_1[0].get_text())


'Python' 카테고리의 다른 글

[python] 이미지 크롤링 + 경로 저장  (0) 2018.02.08
[PYTHON] 웹크롤러  (0) 2017.12.15
[python] list 선언  (0) 2017.12.01
[python] 디렉토리에 특정파일 찾기  (0) 2017.12.01
[python]꺽은선 그래프  (0) 2017.12.01
Comments