https://m.search.naver.com/search.naver?where=m_news&query=1%EB%B3%B4&sm=mtb_tnw&sort=1
How do I route the subject of the article exposed in the link above to get 20 article titles, starting with the most recent one?
I found the api_txt_linesit, but I don't know what to do next.
python crawling naver
Beautiful Soup makes it easy to implement.
Python code to print the title of the breaking news article.
from bs4 import BeautifulSoup
import urllib.request
# Import html source
url = 'https://m.search.naver.com/search.naver?where=m_news&query=1%EB%B3%B4&sm=mtb_tnw&sort=1'
with urllib.request.urlopen(url) as response:
html = response.read()
soup = BeautifulSoup(html, 'html.parser')
articles = soup.found_all('div', {'class': 'api_txt_linesit'}) # Get article title
# To print out the article title
for article in articles:
title = article.text
print(title)
547 Who developed the "avformat-59.dll" that comes with FFmpeg?
548 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
549 PHP ssh2_scp_send fails to send files as intended
537 Uncaught (inpromise) Error on Electron: An object could not be cloned
710 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.