| 1 |
#!/usr/bin/env python |
| 2 |
__license__ = 'GPL v3' |
| 3 |
__copyright__ = '2009 Kovid Goyal <kovid at kovidgoyal.net>' |
| 4 |
|
| 5 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 6 |
|
| 7 |
|
| 8 |
class AdvancedUserRecipe1234144423(BasicNewsRecipe): |
| 9 |
title = 'Cincinnati Enquirer' |
| 10 |
oldest_article = 7 |
| 11 |
language = 'en_US' |
| 12 |
|
| 13 |
__author__ = 'Joseph Kitzmiller and Sujata Raman' |
| 14 |
max_articles_per_feed = 100 |
| 15 |
no_stylesheets = True |
| 16 |
use_embedded_content = False |
| 17 |
remove_javascript = True |
| 18 |
encoding = 'cp1252' |
| 19 |
extra_css = ''' |
| 20 |
h1{font-family:Arial,Helvetica,sans-serif; font-size:large; color:#0E5398; } |
| 21 |
h2{color:#666666;} |
| 22 |
.blog_title{color:#4E0000; font-family:Georgia,"Times New Roman",Times,serif; font-size:large;} |
| 23 |
.sidebar-photo{font-family:Arial,Helvetica,sans-serif; color:#333333; font-size:30%;} |
| 24 |
.blog_post{font-family:Arial,Helvetica,sans-serif; color:#222222; font-size:xx-small;} |
| 25 |
.article-bodytext{font-family:Arial,Helvetica,sans-serif; font-size:xx-small; color:#222222;font-weight:normal;} |
| 26 |
.blog caitlin{font-family:Arial,Helvetica,sans-serif; font-size:xx-small; color:#222222; font-weight:normal;} |
| 27 |
.ratingbyline{font-family:Arial,Helvetica,sans-serif; color:#333333; font-size:50%;} |
| 28 |
.author{font-family:Arial,Helvetica,sans-serif; color:#777777; font-size:50%;} |
| 29 |
.date{font-family:Arial,Helvetica,sans-serif; color:#777777; font-size:50%;} |
| 30 |
.padding{font-family:Arial,Helvetica,sans-serif; font-size:70%; color:#222222; font-weight:normal;} |
| 31 |
''' |
| 32 |
|
| 33 |
keep_only_tags = [dict(name='div', attrs={'class': ['padding', 'sidebar-photo', 'blog caitlin']})] |
| 34 |
|
| 35 |
remove_tags = [ |
| 36 |
dict(name=['object', 'link', 'table', 'embed']), |
| 37 |
dict(name='div', attrs={'id': ['pluckcomments', 'StoryChat']}), |
| 38 |
dict( |
| 39 |
name='div', |
| 40 |
attrs={ |
| 41 |
'class': [ |
| 42 |
'articleflex-container', |
| 43 |
] |
| 44 |
}, |
| 45 |
), |
| 46 |
dict(name='p', attrs={'class': ['posted', 'tags']}), |
| 47 |
] |
| 48 |
|
| 49 |
feeds = [('Cincinnati Enquirer', 'http://rss.cincinnati.com/apps/pbcs.dll/section?category=rssenq01&mime=xml')] |
| 50 |
|
| 51 |
def preprocess_html(self, soup): |
| 52 |
for item in soup.findAll(style=True): |
| 53 |
del item['style'] |
| 54 |
for item in soup.findAll(face=True): |
| 55 |
del item['face'] |
| 56 |
return soup |