This commit is contained in:
Kovid Goyal 2023-09-15 11:21:15 +05:30
parent 06752c03cc
commit 46ad724b27
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -3,7 +3,7 @@ import re
from urllib.parse import quote
from html5_parser import parse
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.web.feeds.news import BasicNewsRecipe, classes
class ft(BasicNewsRecipe):
@ -25,7 +25,7 @@ class ft(BasicNewsRecipe):
.article-info__time-byline {font-size:small; font-weight:bold; }
.o-topper__visual, #fig, .main-image, .n-content-image { text-align:center; font-size:small; }
blockquote, i { color:#5c5c5c; }
.o-topper__standfirst { font-weight:bold; color:#202020; }
.o-topper__standfirst { font-weight:bold; color:#202020; }
.o-topper__topic { font-size:small; color:#5c5c5c; }
'''
@ -35,7 +35,7 @@ class ft(BasicNewsRecipe):
),
dict(name='article', attrs={'id':'article-body'})
]
remove_tags = [
dict(name='aside', attrs={'class':'n-content-recommended--single-story'}),
classes('in-article-advert')
@ -100,7 +100,7 @@ class ft(BasicNewsRecipe):
# with open('/t/raw.html', 'w') as f:
# f.write(raw)
root = parse(raw)
if x := root.xpath('//article[@id="article-body"]'):
if root.xpath('//article[@id="article-body"]'):
self.log('**has article content')
return raw
self.log('**no article content')