爬蟲抓取新聞模塊提取庫推薦newspaper

安裝

pip3 install newspaper3k

使用

from newspaper import Article

url = 'http://www.example.com/path/to/article'
article = Article(url)
article.download()
article.parse()

text = article.text # 獲取新聞正文
images = article.images # 獲取新聞圖片
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章