This commit is contained in:
Kovid Goyal 2023-10-23 13:11:48 +05:30
commit 74bb2c4c9d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 15 additions and 0 deletions

View File

@ -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'

View File

@ -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