calibre/recipes/drivelry.recipe
2024-03-30 13:03:29 +05:30

37 lines
1.0 KiB
Python

from calibre.ebooks.BeautifulSoup import BeautifulSoup
from calibre.web.feeds.news import BasicNewsRecipe
class drivelrycom(BasicNewsRecipe):
title = u'drivelry.com'
language = 'en'
description = 'A blog by Mike Abrahams'
__author__ = 'Krittika Goyal'
oldest_article = 60 # days
max_articles_per_feed = 25
remove_stylesheets = True
remove_tags_after = dict(name='div', attrs={'id': 'bookmark'})
remove_tags = [
dict(name='iframe'),
dict(name='div', attrs={'class': ['sidebar']}),
dict(name='div', attrs={'id': ['bookmark']}),
]
feeds = [
('drivelry.com',
'http://feeds.feedburner.com/drivelry'),
]
def preprocess_html(self, soup):
story = soup.find(name='div', attrs={'id': 'main'})
soup = BeautifulSoup('''
<html><head><title>t</title></head><body>
<p>To donate to this blog: <a href="http://www.drivelry.com/thank-you/">click here</a></p>
</body></html>
''')
body = soup.find(name='body')
body.insert(0, story)
return soup