mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Improved recipe for Our Daily Bread
This commit is contained in:
parent
91c7ac997c
commit
fc84ea2d15
@ -10,10 +10,11 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
||||
|
||||
class OurDailyBread(BasicNewsRecipe):
|
||||
title = 'Our Daily Bread'
|
||||
__author__ = 'Darko Miletic'
|
||||
__author__ = 'Darko Miletic and Sujata Raman'
|
||||
description = 'Religion'
|
||||
oldest_article = 15
|
||||
language = 'en'
|
||||
lang = 'en'
|
||||
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
@ -21,16 +22,43 @@ class OurDailyBread(BasicNewsRecipe):
|
||||
category = 'religion'
|
||||
encoding = 'utf-8'
|
||||
extra_css = ' #devoTitle{font-size: x-large; font-weight: bold} '
|
||||
|
||||
conversion_options = {
|
||||
|
||||
conversion_options = {
|
||||
'comments' : description
|
||||
,'tags' : category
|
||||
,'language' : 'en'
|
||||
}
|
||||
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':['altbg','text']})]
|
||||
|
||||
remove_tags = [dict(name='div', attrs={'id':['ctl00_cphPrimary_pnlBookCover']}),
|
||||
dict(name='div', attrs={'class':['devotionalLinks']})
|
||||
]
|
||||
extra_css = '''
|
||||
.text{font-family:Arial,Helvetica,sans-serif;font-size:x-small;}
|
||||
.devotionalTitle{font-family:Arial,Helvetica,sans-serif; font-size:large; font-weight: bold;}
|
||||
.devotionalDate{font-family:Arial,Helvetica,sans-serif; font-size:xx-small;}
|
||||
.devotionalVerse{font-family:Arial,Helvetica,sans-serif; font-size:xx-small; }
|
||||
'''
|
||||
|
||||
feeds = [(u'Our Daily Bread', u'http://www.rbc.org/rss.ashx?id=50398')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
soup.html['xml:lang'] = self.lang
|
||||
soup.html['lang'] = self.lang
|
||||
mtag = '<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '">'
|
||||
soup.head.insert(0,mtag)
|
||||
|
||||
return self.adeify_images(soup)
|
||||
|
||||
def get_cover_url(self):
|
||||
|
||||
href = 'http://www.rbc.org/index.aspx'
|
||||
|
||||
soup = self.index_to_soup(href)
|
||||
a = soup.find('a',attrs={'id':'ctl00_hlTodaysDevotionalImage'})
|
||||
|
||||
if a :
|
||||
cover_url = a.img['src']
|
||||
|
||||
return cover_url
|
||||
|
Loading…
x
Reference in New Issue
Block a user