I am getting an error below, but it was previously working, and works in another program where I use the parse method. Is there something I may be doing wrong?
When I call it in the shell, there is no error.
>>> article_cleaner = lxml.html.clean.Cleaner()
My code:
from newspaper import Article
article = Article(url="http://sports.nationalpost.com/2014/11/22/toronto-raptors-overcome-slow-start-to-hand-cleveland-cavaliers-fourth-straight-loss/", keep_article_html=True)
article.download()
article.parse()
print article.title
print article.authors
print article.text
print article.published_date
print article.article_html
Error:
Traceback (most recent call last):
File "newspaper_trial.py", line 5, in <module>
article.parse()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/article.py", line 221, in parse
self.top_node)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/outputformatters.py", line 47, in get_formatted
html = self.convert_to_html()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/outputformatters.py", line 68, in convert_to_html
cleaned_node = self.parser.clean_article_html(self.get_top_node())
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/newspaper/parsers.py", line 62, in clean_article_html
article_cleaner = lxml.html.clean.Cleaner()
AttributeError: 'module' object has no attribute 'clean'
I am getting an error below, but it was previously working, and works in another program where I use the parse method. Is there something I may be doing wrong?
When I call it in the shell, there is no error.
My code:
Error: