From 6c82706281859edb485ec9f0c6e16d3386f41858 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 16 Oct 2020 12:27:55 +0530 Subject: [PATCH] Minor cleanups for Guradian --- recipes/guardian.recipe | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/recipes/guardian.recipe b/recipes/guardian.recipe index ab6a1382e7..af8b243e1d 100644 --- a/recipes/guardian.recipe +++ b/recipes/guardian.recipe @@ -11,6 +11,12 @@ from calibre.web.feeds.news import BasicNewsRecipe from datetime import date +def classes(classes): + q = frozenset(classes.split(' ')) + return dict(attrs={ + 'class': lambda x: x and frozenset(x.split()).intersection(q)}) + + class Guardian(BasicNewsRecipe): title = u'The Guardian and The Observer' @@ -47,6 +53,7 @@ class Guardian(BasicNewsRecipe): dict(attrs={'data-link-name': 'block share'}), dict(attrs={'class': lambda x: x and 'inline-expand-image' in x}), dict(attrs={'class': lambda x: x and 'modern-visible' in x.split()}), + classes('badge-slot reveal-caption__checkbox mobile-only element-rich-link'), dict(name=['link', 'meta', 'style']), ] remove_tags_after = [