calibre/recipes/cosmopolitan_uk.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

41 lines
1.5 KiB
Plaintext

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].+</title>',
re.DOTALL), lambda m: '</title>'),
]:
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/')]