Hello,
I would appreciate someone setting up a custom recipe for The Christian Post.
I attempted to do so and this is what I come up with.
Thanks for any help provided!
George
edit: I actually think I got it figured out. If anyone has some adjustments they could recommend they will definitely be appreciated as this is my first recipe.
Code:
__license__ = 'GPL v3'
__copyright__ = '2010, George Algozzini <galgoz at gmail.com>'
'''
Profile to download The Christian Post
'''
import re
from calibre.web.feeds.news import BasicNewsRecipe
class TheChristianPost(BasicNewsRecipe):
title = 'The Christian Post'
description = 'Homepage'
language = 'en'
no_stylesheets = True
use_embedded_content = False
oldest_article = 3
max_articles_per_feed = 25
remove_tags_before = dict(attrs={'id':'section'})
remove_tags_after = dict(attrs={'class':'banner468x60'})
remove_tags = [dict(attrs={'class':['relatedTopic', 'getfaceBook', 'plus', 'minus', 'tool', 'share', 'facebook', 'twitter', 'print', 'email', 'clear', 'relatedArticle']})]
extra_css = '''
h1 {color:#008852;font-family:Arial,Helvetica,sans-serif; font-size:20px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:18px;}
h2 {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif; font-size:16px; font-size-adjust:none; font-stretch:normal; font-style:normal; font-variant:normal; font-weight:bold; line-height:16px; }
'''
feeds = [
('Homepage', 'http://www.christianpost.com/services/rss/feed/'),
('Most Popular', 'http://www.christianpost.com/services/rss/feed/most-popular'),
('Entertainment', 'http://www.christianpost.com/services/rss/feed/entertainment/'),
('Politics', 'http://www.christianpost.com/services/rss/feed/politics/'),
('Living', 'http://www.christianpost.com/services/rss/feed/living/'),
('Business', 'http://www.christianpost.com/services/rss/feed/business/'),
('Opinion', 'http://www.christianpost.com/services/rss/feed/opinion/')
]
def get_article_url(self, article):
ans = BasicNewsRecipe.get_article_url(self, article)
return ans.partition('?')[0]