They download content for 60 days starting from today. So one may ask Calibre to download these sources every 30 or 60 days.
Writing recipes are relatively easy tasks. The difficult task is to read them daily!
每日聖言
------------------------------------- recipe starts below ------------------------------------from datetime import date, timedelta
class MeiRiShengYan(AutomaticNewsRecipe):
title = u'\u6bcf\u65e5\u8056\u8a00'
oldest_article = 35
max_articles_per_feed = 100
auto_cleanup = True
no_stylesheets = True
encoding = 'big5-hkscs'
cover_url = 'http://liturgy.catholic.org.hk/dlcgif.gif'
def parse_index(self):
today = date.today()
current = today
feeds = []
articles = []
while (current - today < timedelta(60)):
url = 'http://catholic-dlc.org.hk/mk' + current.strftime('%y%m%d') + '.htm'
title = current.isoformat()
articles.append({'title':title, 'url':url,
'description':None, 'date':current})
current += timedelta(1)
feeds.append((u'\u6bcf\u65e5\u8056\u8a00', articles))
return feeds
def populate_article_metadata(self, article, soup, first):
title = soup.find('p', attrs={'class':['MsoNormal','MsoPlainText'], 'align':'center'})
if title:
article.summary = self.tag_to_string(title)
article.text_summary = article.summary
------------------------------------- recipe ends above ------------------------------------
每日日課
------------------------------------- recipe starts below ------------------------------------from datetime import date, timedelta
class MeiRiRiKe(AutomaticNewsRecipe):
title = '每日日課'
oldest_article = 35
max_articles_per_feed = 300
auto_cleanup = True
feeds = []
no_stylesheets = True
encoding = 'big5-hkscs'
cover_url = 'http://liturgy.catholic.org.hk/dlcgif.gif'
map = {'LH1': '晨', 'LH2': '日', 'LH3': '晚', 'LH4': '誦', 'LH5': '夜'}
pages = list(map.keys())
pages.sort()
def parse_index(self):
today = date.today()
current = today
feeds = []
articles = []
while (current - today < timedelta(60)):
for page in self.pages:
url = "http://catholic-dlc.org.hk/%s_%s.htm" % (page, current.strftime('%Y%m%d'))
title = current.isoformat() + self.map[page]
articles.append({'title':title, 'url':url, 'description':None, 'date':current})
current += timedelta(1)
feeds.append(('每日日課', articles))
return feeds
def populate_article_metadata(self, article, soup, first):
title = soup.find('p', attrs={'class':['MsoNormal','MsoPlainText'], 'align':'center'})
if title:
article.summary = self.tag_to_string(title)
article.text_summary = article.summary
------------------------------------- recipe ends above ------------------------------------