Fix #1459 (Recipe: slight improvement to Hindu)

This commit is contained in:
Kovid Goyal 2021-06-20 21:15:06 +05:30
parent 9904f33941
commit ff01e16610
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1,10 +1,12 @@
from __future__ import with_statement #!/usr/bin/env python
__license__ = 'GPL 3' # vim:fileencoding=utf-8
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>' # License: GPLv3 Copyright: 2009, Kovid Goyal <kovid at kovidgoyal.net>
from calibre.web.feeds.news import BasicNewsRecipe
import string import string
from calibre import entity_to_unicode
from calibre.web.feeds.news import BasicNewsRecipe
def classes(classes): def classes(classes):
q = frozenset(classes.split(' ')) q = frozenset(classes.split(' '))
@ -67,6 +69,7 @@ class TheHindu(BasicNewsRecipe):
try: try:
desc = soup.find('meta', attrs={'name': 'description'}).get('content') desc = soup.find('meta', attrs={'name': 'description'}).get('content')
if not desc.startswith('Todays paper'): if not desc.startswith('Todays paper'):
desc = entity_to_unicode(desc)
desc += '...' if len(desc) >= 199 else '' # indicate truncation desc += '...' if len(desc) >= 199 else '' # indicate truncation
article.text_summary = article.summary = desc article.text_summary = article.summary = desc
except AttributeError: except AttributeError: