import re from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1390635673(BasicNewsRecipe): title = u'Cosmopolitan UK' description = 'Womens Fashion, beauty and Gossip for women from COSMOPOLITAN -UK' language = 'en_GB' __author__ = 'Dave Asbury' # 2/2/14 oldest_article = 28 max_articles_per_feed = 10 compress_news_images = True compress_news_images_max_size = 20 auto_cleanup_keep = '//div[@class="articleHeading"]' auto_cleanup = True ignore_duplicate_articles = {'title', 'url'} no_stylesheets = True masthead_url = 'http://www.cosmopolitan.co.uk//cm/cosmopolitanuk/site_images/site_logo.gif' cover_url = 'http://www.natmagnewsletters.co.uk/CIRCULES/CosmoXXLCover.jpg' # kovids code def preprocess_raw_html(self, raw_html, url): for pat, f in [ (re.compile(r':: [\w].+', re.DOTALL), lambda m: ''), ]: raw_html = pat.sub(f, raw_html) return raw_html feeds = [ (u'Love & Sex', u'http://www.cosmopolitan.co.uk/love-sex/rss/'), (u'Men', u'http://cosmopolitan.co.uk/men/rss/'), (u'Fashion', u'http://cosmopolitan.co.uk/fashion/rss/'), (u'Hair & Beauty', u'http://cosmopolitan.co.uk/beauty-hair/rss/'), (u'LifeStyle', u'http://cosmopolitan.co.uk/lifestyle/rss/'), (u'Cosmo On Campus', u'http://cosmopolitan.co.uk/campus/rss/'), (u'Celebrity Gossip', u'http://cosmopolitan.co.uk/celebrity-gossip/rss/')]