calibre/recipes/nytimes_tech.recipe
2017-04-16 10:18:54 +05:30

40 lines
1.0 KiB
Python

#!/usr/bin/env python2
# encoding: utf-8
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = 'zotzo'
__docformat__ = 'restructuredtext en'
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 NYTimesTechnology(BasicNewsRecipe):
title = 'New York Times Technology Beat'
language = 'en'
description = 'The latest in technology from David Pogue'
publisher = 'The New York Times'
category = 'Technology'
oldest_article = 14
max_articles_per_feed = 25
remove_empty_feeds = True
no_stylesheets = True
language = 'en'
feeds = [
(u'Gadgetwise', u'http://gadgetwise.blogs.nytimes.com/feed/'),
]
keep_only_tags = [
dict(name='h1'),
classes('extended-byline story-body'),
]
remove_tags = [
classes('visually-hidden newsletter-signup nocontent robots-nocontent hidden'),
]