From 5862e8057a3d3f725ccb79833049dd71deb668b1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 5 Oct 2021 09:20:48 +0530 Subject: [PATCH] Update Dawn --- recipes/dawn.recipe | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/recipes/dawn.recipe b/recipes/dawn.recipe index ea49bcd797..8d3a4e10da 100644 --- a/recipes/dawn.recipe +++ b/recipes/dawn.recipe @@ -1,6 +1,12 @@ from calibre.web.feeds.news import BasicNewsRecipe +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class DawnRecipe(BasicNewsRecipe): __license__ = 'GPL v3' __author__ = 'kwetal' @@ -21,9 +27,8 @@ class DawnRecipe(BasicNewsRecipe): remove_javascript = True encoding = 'utf-8' keep_only_tags = [ - dict(name='div', attrs={'class': 'push-half--sides push--top'}), - dict(name='article', attrs={'class': 'story story--single push-half'})] - + classes('template__header template__main') + ] # Feeds from # http://www.dawn.com/wps/wcm/connect/dawn-content-library/dawn/services/rss feeds = []