From f908d8ce19040eafc8e92b41a3ba9a8f2fa27a4b Mon Sep 17 00:00:00 2001 From: unkn0w7n <51942695+unkn0w7n@users.noreply.github.com> Date: Mon, 23 Oct 2023 12:56:53 +0530 Subject: [PATCH] ... --- recipes/wsj.recipe | 3 +++ recipes/wsj_free.recipe | 12 ++++++++++++ 2 files changed, 15 insertions(+) diff --git a/recipes/wsj.recipe b/recipes/wsj.recipe index 00a0a5b4e3..d7f45271e4 100644 --- a/recipes/wsj.recipe +++ b/recipes/wsj.recipe @@ -52,6 +52,7 @@ class WSJ(BasicNewsRecipe): #big-top-caption { font-size:small; text-align:center; } [data-type:"tagline"], em { font-style:italic; color:#202020; } .auth { font-size:small; } + .sub, em, i { color: #202020; } ''' keep_only_tags = [ @@ -102,6 +103,8 @@ class WSJ(BasicNewsRecipe): for h2 in soup.findAll('h2'): if self.tag_to_string(h2).startswith(('What to Read Next', 'Conversation')): h2.extract() + h2.name = 'h3' + h2['class'] = 'sub' for ph in soup.findAll('a', attrs={'data-type':['phrase', 'link']}): if div := ph.findParent('div'): div.name = 'span' diff --git a/recipes/wsj_free.recipe b/recipes/wsj_free.recipe index d6a123e2e8..419ddacaae 100644 --- a/recipes/wsj_free.recipe +++ b/recipes/wsj_free.recipe @@ -53,6 +53,8 @@ class WSJ(BasicNewsRecipe): extra_css = ''' #big-top-caption { font-size:small; text-align:center; } [data-type:"tagline"] { font-style:italic; color:#202020; } + .auth { font-size:small; } + .sub, em, i { color: #202020; } ''' keep_only_tags = [ @@ -102,6 +104,16 @@ class WSJ(BasicNewsRecipe): for h2 in soup.findAll('h2'): if self.tag_to_string(h2).startswith(('What to Read Next', 'Conversation')): h2.extract() + h2.name = 'h3' + h2['class'] = 'sub' + for ph in soup.findAll('a', attrs={'data-type':['phrase', 'link']}): + if div := ph.findParent('div'): + div.name = 'span' + for auth in soup.findAll('a', attrs={'aria-label': lambda x: x and x.startswith('Author page')}): + if div := auth.find_previous_sibling('div'): + div.name = 'span' + if parent := auth.findParent('div'): + parent['class'] = 'auth' return soup