
id = #
<div id = "articleBody"> 본문 내용입니다.</div>
∴ #articleBody
class = .
<div class = "info_group"> 뉴스목록 </div>
∴ .info_group
별명이 없을 때,
1) <div class="logo_sport"><span>스포츠</span></div>
∴ .logo_sport > span
2) <div class="news_headlinet"><h4>제목</h4></div>
∴ .news_headlin > h4
URL

import requests
from bs4 import BeautifulSoup
keyword = input("검색어를 입력하세요.")
lastpage = input("페이지 수를 입력해주세요.")
pageNum = 1
print(f"{pageNum} 페이지 입니다. ----------------------------------")
for i in rang(1, int(lastpage)*10, 10)
response = requests.get(f"https:~{lastpage})
html = response.text
links = soup.select(".new_tit")
for link in links:
title = link.text
url = link.attrs['href']
print(title, url)
pageNum += 1
'Mind Security > ETC' 카테고리의 다른 글
[ETC] 스마트폰 중독, 당신은 (0) | 2022.02.19 |
---|---|
[ETC]친구를 돈주고 사는 사회, 청년들 (0) | 2022.02.02 |
[ETC]개인연금 선택을 위한 기초 이해_1 for 노후준비 (0) | 2022.01.16 |
[ETC]파트너에게서 살아남기, 게임 (0) | 2021.12.23 |
[ETC]이번 크리스마스 당신이 헤리포터 기숙사에 들어가다면 (0) | 2021.12.18 |