Update FOX News

This commit is contained in:
Kovid Goyal 2017-07-08 09:55:06 +05:30
parent 21f37bde8c
commit 1e699453f7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -1,12 +1,15 @@
__license__ = 'GPL v3' #!/usr/bin/env python2
__copyright__ = '2010-2011, Darko Miletic <darko.miletic at gmail.com>' # vim:fileencoding=utf-8
''' from __future__ import unicode_literals, division, absolute_import, print_function
foxnews.com
'''
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
def classes(classes):
q = frozenset(classes.split(' '))
return dict(
attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)})
class FoxNews(BasicNewsRecipe): class FoxNews(BasicNewsRecipe):
title = 'FOX News' title = 'FOX News'
__author__ = 'Darko Miletic' __author__ = 'Darko Miletic'
@ -18,34 +21,36 @@ class FoxNews(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
encoding = 'utf8' encoding = 'utf8'
use_embedded_content = False use_embedded_content = False
language = 'en' language = 'en'
publication_type = 'newsportal'
remove_empty_feeds = True remove_empty_feeds = True
extra_css = """ extra_css = """
body{font-family: Arial,sans-serif } body{font-family: Arial,sans-serif }
.caption{font-size: x-small} .caption{font-size: x-small}
.author,.dateline{font-size: small} .author,.dateline{font-size: small}
""" """
conversion_options = { conversion_options = {
'comment': description, 'tags': category, 'publisher': publisher, 'language': language 'comment': description,
} 'tags': category,
'publisher': publisher,
'language': language}
remove_attributes = ['xmlns', 'lang'] remove_attributes = ['xmlns', 'lang']
ignore_duplicate_articles = {'title', 'url'}
keep_only_tags = [ keep_only_tags = [
dict(itemprop=['headline', 'articleBody']),
dict(name='h1'), dict(name='h1'),
dict(attrs={'class':'article-info article-body'.split()}), classes('byline author date source article-info article-body featured-image'),
] ]
feeds = [ feeds = [(u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest'),
(u'National', u'http://feeds.foxnews.com/foxnews/national'),
(u'Latest Headlines', u'http://feeds.foxnews.com/foxnews/latest'), (u'World', u'http://feeds.foxnews.com/foxnews/world'),
(u'National', u'http://feeds.foxnews.com/foxnews/national'), (u'Politics', u'http://feeds.foxnews.com/foxnews/politics'),
(u'World', u'http://feeds.foxnews.com/foxnews/world'), (u'Opinion', u'http://feeds.foxnews.com/foxnews/opinion'),
(u'Politics', u'http://feeds.foxnews.com/foxnews/politics'), (u'Science', u'http://feeds.foxnews.com/foxnews/science'),
(u'Business', u'http://feeds.foxnews.com/foxnews/business'), (u'Technology', u'http://feeds.foxnews.com/foxnews/tech'),
(u'SciTech', u'http://feeds.foxnews.com/foxnews/scitech'), (u'Health', u'http://feeds.foxnews.com/foxnews/health'),
(u'Health', u'http://feeds.foxnews.com/foxnews/health'), (u'Lifestyle', u'http://feeds.foxnews.com/foxnews/section/lifestyle'),
(u'Entertainment', u'http://feeds.foxnews.com/foxnews/entertainment') (u'Travel', u'http://feeds.foxnews.com/foxnews/internal/travel/mixed')]
]