News download: Do not add aborted/failed article titles to the comments metadata

This commit is contained in:
Kovid Goyal 2022-07-13 08:58:43 +05:30
parent cbebaee824
commit ed10c21b76
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -975,6 +975,7 @@ class BasicNewsRecipe(Recipe):
templates.NavBarTemplate() templates.NavBarTemplate()
self.failed_downloads = [] self.failed_downloads = []
self.partial_failures = [] self.partial_failures = []
self.aborted_articles = []
def _postprocess_html(self, soup, first_fetch, job_info): def _postprocess_html(self, soup, first_fetch, job_info):
if self.no_stylesheets: if self.no_stylesheets:
@ -1476,6 +1477,10 @@ class BasicNewsRecipe(Recipe):
mi.publication_type = 'periodical:'+self.publication_type+':'+self.short_title() mi.publication_type = 'periodical:'+self.publication_type+':'+self.short_title()
mi.timestamp = nowf() mi.timestamp = nowf()
article_titles, aseen = [], set() article_titles, aseen = [], set()
for (af, aa) in self.aborted_articles:
aseen.add(aa.title)
for (ff, fa, tb) in self.failed_downloads:
aseen.add(fa.title)
for f in feeds: for f in feeds:
for a in f: for a in f:
if a.title and a.title not in aseen: if a.title and a.title not in aseen:
@ -1653,6 +1658,7 @@ class BasicNewsRecipe(Recipe):
'from', request.article.url) 'from', request.article.url)
self.report_progress(float(self.jobs_done)/len(self.jobs), self.report_progress(float(self.jobs_done)/len(self.jobs),
_('Article download aborted: %s')%force_unicode(request.article.title)) _('Article download aborted: %s')%force_unicode(request.article.title))
self.aborted_articles.append((request.feed, request.article))
else: else:
self.log.error('Failed to download article:', request.article.title, self.log.error('Failed to download article:', request.article.title,
'from', request.article.url) 'from', request.article.url)