Downloading articles from multiple urls with newspaper

青春壹個敷衍的年華 提交于 2019-12-06 14:36:04
Ami Hollander

You get the exception

it returned the following error: unsupported operand type for %:'article' and 'str'

because you are populating the wrong variable and on line 9 you should have:

first_article = Article(url="%s" % list, language='de')

and here's the full code:

import newspaper
from newspaper import Article

lista = ['url','url']


for list in lista:

   first_article = Article(url="%s" % list, language='de')

   first_article.download()

   first_article.parse()

   print(first_article.text)
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!