mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Consortium News by kiavash
This commit is contained in:
parent
25e8de6244
commit
0b4f34cb2d
71
recipes/consortium_news.recipe
Normal file
71
recipes/consortium_news.recipe
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
##
|
||||||
|
## Title: Consortium News
|
||||||
|
##
|
||||||
|
## License: GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html
|
||||||
|
|
||||||
|
# Feb 2012: Initial release
|
||||||
|
__license__ = 'GNU General Public License v3 - http://www.gnu.org/copyleft/gpl.html'
|
||||||
|
'''
|
||||||
|
consortiumnews.com
|
||||||
|
'''
|
||||||
|
import re
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class ConsortiumNews(BasicNewsRecipe):
|
||||||
|
|
||||||
|
title = u'Consortium News'
|
||||||
|
publisher = 'Copyright © 2012 Consortiumnews. All Rights Reserved.'
|
||||||
|
language = 'en'
|
||||||
|
__author__ = 'kiavash'
|
||||||
|
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
|
||||||
|
no_stylesheets = True
|
||||||
|
remove_javascript = True
|
||||||
|
|
||||||
|
conversion_options = {'linearize_tables' : True} # Flattens all the tables to make it compatible with Nook
|
||||||
|
|
||||||
|
remove_attributes = [ 'border', 'cellspacing', 'align', 'cellpadding', 'colspan',
|
||||||
|
'valign', 'vspace', 'hspace', 'alt', 'width', 'height' ]
|
||||||
|
|
||||||
|
# Specify extra CSS - overrides ALL other CSS (IE. Added last).
|
||||||
|
extra_css = 'body { font-family: verdana, helvetica, sans-serif; } \
|
||||||
|
.introduction, .first { font-weight: bold; } \
|
||||||
|
.cross-head { font-weight: bold; font-size: 125%; } \
|
||||||
|
.cap, .caption { display: block; font-size: 80%; font-style: italic; } \
|
||||||
|
.cap, .caption, .caption img, .caption span { display: block; margin: 5px auto; } \
|
||||||
|
.byl, .byd, .byline img, .byline-name, .byline-title, .author-name, .author-position, \
|
||||||
|
.correspondent-portrait img, .byline-lead-in, .name, .bbc-role { display: block; \
|
||||||
|
font-size: 80%; font-style: italic; margin: 1px auto; } \
|
||||||
|
.story-date, .published { font-size: 80%; } \
|
||||||
|
table { width: 100%; } \
|
||||||
|
td img { display: block; margin: 5px auto; } \
|
||||||
|
ul { padding-top: 10px; } \
|
||||||
|
ol { padding-top: 10px; } \
|
||||||
|
li { padding-top: 5px; padding-bottom: 5px; } \
|
||||||
|
h1 { font-size: 175%; font-weight: bold; } \
|
||||||
|
h2 { font-size: 150%; font-weight: bold; } \
|
||||||
|
h3 { font-size: 125%; font-weight: bold; } \
|
||||||
|
h4, h5, h6 { font-size: 100%; font-weight: bold; }'
|
||||||
|
|
||||||
|
# Remove the line breaks and float left/right and picture width/height.
|
||||||
|
preprocess_regexps = [(re.compile(r'<br[ ]*/>', re.IGNORECASE), lambda m: ''),
|
||||||
|
(re.compile(r'<br[ ]*clear.*/>', re.IGNORECASE), lambda m: ''),
|
||||||
|
(re.compile(r'float:.*?'), lambda m: ''),
|
||||||
|
(re.compile(r'width:.*?px'), lambda m: ''),
|
||||||
|
(re.compile(r'height:.*?px'), lambda m: ''),
|
||||||
|
(re.compile(r'<a.*?>'), lambda h1: ''),
|
||||||
|
(re.compile(r'</a>'), lambda h2: ''),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Main article is inside this tag
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':lambda x: x and 'post-' in x})]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div', attrs={'class':'sociable'}), # remove 'Share this Article'
|
||||||
|
dict(name='p', attrs={'class':'tags'}), # remove 'Tags: ... '
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [(u'Consortium News', u'http://feeds.feedburner.com/Consortiumnewscom')]
|
Loading…
x
Reference in New Issue
Block a user