1
0
mirror of https://github.com/fhamborg/news-please.git synced 2021-09-19 22:26:00 +03:00

Merge pull request #202 from mood-mapping-muppets/empty-publish-date-newspaper-extractor

Handle publish_date == "" in newspaper_extractor
This commit is contained in:
Felix Hamborg
2021-02-11 16:32:54 +01:00
committed by GitHub

View File

@@ -33,7 +33,7 @@ class NewspaperExtractor(AbstractExtractor):
article_candidate.text = article.text
article_candidate.topimage = article.top_image
article_candidate.author = article.authors
if article.publish_date is not None:
if article.publish_date:
try:
article_candidate.publish_date = article.publish_date.strftime('%Y-%m-%d %H:%M:%S')
except ValueError as exception: