- Reference : https://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=101&oid=030&aid=0002881076
- Install newspaper3k package.
!pip install newspaper3k
News data scrapping code
# Import module 'Article' from 'newspaper' package
from newspaper import Article
# News link for crawling
url = 'https://news.naver.com/main/read.nhn?mode=LSD&mid=sec&sid1=101&oid=030&aid=0002881076'
# Set a language based on the news. For Korean, language='ko'
article = Article(url, language='ko')
# Download the news,
article.download()
# And look for the title and body of the news.
article.parse()
It does not print anything. To see how it's parsed, you need to run
print(article.title)andprint(article.text)
print(article.title)

print(article.text)

Comments
Join the discussionNo comments yet. Be the first to comment.