fhamborg / news-please

news-please - an integrated web crawler and information extractor for news that just works
Apache License 2.0
2.08k stars 428 forks source link

AttributeError: 'NewsArticle' object has no attribute 'publish_date' #60

Closed tsoahans closed 6 years ago

tsoahans commented 6 years ago

The error has happened when I run the example code "commoncrawl.py".

This will cause the program to stop.

The bug is in the function __get_publishing_date in commoncrawl_extractor.py.

It should be checked whether the attribute is existing before accessing "article.publish_date".

I don't know why did this bug happen, I just add

if not hasattr(article, "publish_date"):
    return None

at the beginning of the function to prevent the program stopping.

fhamborg commented 6 years ago

you may get the fix by running pip3 install -U news-please