home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Narzedzia
/
Calibre
/
calibre-0.8.18.msi
/
file_280
/
foxnews.recipe
< prev
next >
Wrap
Text File
|
2011-09-09
|
3KB
|
79 lines
__license__ = 'GPL v3'
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>'
'''
foxnews.com
'''
from calibre.web.feeds.news import BasicNewsRecipe
class FoxNews(BasicNewsRecipe):
title = 'FOX News'
__author__ = 'Darko Miletic'
description = 'Breaking News from FOX'
publisher = 'FOXNews.com'
category = 'news, breaking news, latest news, current news, world news, national news, USA'
oldest_article = 2
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'utf8'
use_embedded_content = False
language = 'en'
publication_type = 'newsportal'
remove_empty_feeds = True
extra_css = """
body{font-family: Arial,sans-serif }
.caption{font-size: x-small}
.author,.dateline{font-size: small}
"""
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
, 'language' : language
}
remove_attributes = ['xmlns','lang']
remove_tags=[
dict(attrs={'class':['user-control','logo','ad-300x250','url-description']})
,dict(name=['meta','base','link','iframe','object','embed'])
]
keep_only_tags=[dict(attrs={'id':'article-print'})]
remove_tags_after =dict(attrs={'class':'url-description'})
feeds = [
(u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest' )
,(u'National' , u'http://feeds.foxnews.com/foxnews/national' )
,(u'World' , u'http://feeds.foxnews.com/foxnews/world' )
,(u'Politics' , u'http://feeds.foxnews.com/foxnews/politics' )
,(u'Business' , u'http://feeds.foxnews.com/foxnews/business' )
,(u'SciTech' , u'http://feeds.foxnews.com/foxnews/scitech' )
,(u'Health' , u'http://feeds.foxnews.com/foxnews/health' )
,(u'Entertainment' , u'http://feeds.foxnews.com/foxnews/entertainment' )
]
def print_version(self, url):
return url + 'print'
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
for item in soup.findAll('a'):
limg = item.find('img')
if item.string is not None:
str = item.string
item.replaceWith(str)
else:
if limg:
item.name = 'div'
item.attrs = []
else:
str = self.tag_to_string(item)
item.replaceWith(str)
for item in soup.findAll('img'):
if not item.has_key('alt'):
item['alt'] = 'image'
return soup