| 1 |
from calibre.ebooks.BeautifulSoup import BeautifulSoup |
| 2 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 3 |
|
| 4 |
|
| 5 |
class SignOfTheTimes(BasicNewsRecipe): |
| 6 |
title = 'Sign of the Times' |
| 7 |
language = 'en' |
| 8 |
__author__ = 'TerminalVeracity' |
| 9 |
oldest_article = 31 # days |
| 10 |
max_articles_per_feed = 50 |
| 11 |
use_embedded_content = False |
| 12 |
|
| 13 |
extra_css = ''' |
| 14 |
h2{font-size: large; margin: .2em 0; text-decoration: none;} |
| 15 |
.image-caption{font-size: medium; font-style:italic; margin: 0 0 1em 0;} |
| 16 |
.article-info{font-size: small; font-style:italic; margin: 0 0 .5em 0;} |
| 17 |
''' |
| 18 |
|
| 19 |
remove_stylesheets = True |
| 20 |
remove_tags = [ |
| 21 |
dict(name='div', attrs={'class': ['article-icon', 'article-print', 'article-footer']}), |
| 22 |
dict(name='span', attrs={'class': ['tiny']}), |
| 23 |
] |
| 24 |
|
| 25 |
feeds = [ |
| 26 |
('Signs', 'http://www.sott.net/xml_engine/signs_rss'), |
| 27 |
] |
| 28 |
|
| 29 |
def preprocess_html(self, soup): |
| 30 |
story = soup.find(name='div', attrs={'class': 'article'}) |
| 31 |
soup = BeautifulSoup('<html><head><title>t</title></head><body></body></html>') |
| 32 |
body = soup.find(name='body') |
| 33 |
body.insert(0, story) |
| 34 |
for div in soup.findAll(attrs={'class': 'image-caption'}): |
| 35 |
for br in div.findAll('br'): |
| 36 |
br.extract() |
| 37 |
return soup |