| 1 |
#!/usr/bin/env python |
| 2 |
|
| 3 |
__license__ = 'GPL v3' |
| 4 |
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>' |
| 5 |
''' |
| 6 |
seattletimes.nwsource.com |
| 7 |
''' |
| 8 |
|
| 9 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 10 |
|
| 11 |
|
| 12 |
def classes(classes): |
| 13 |
q = frozenset(classes.split(' ')) |
| 14 |
return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) |
| 15 |
|
| 16 |
|
| 17 |
class SeattleTimes(BasicNewsRecipe): |
| 18 |
title = 'The Seattle Times' |
| 19 |
__author__ = 'Kovid Goyal' |
| 20 |
description = 'News from Seattle and USA' |
| 21 |
publisher = 'The Seattle Times' |
| 22 |
category = 'news, politics, USA' |
| 23 |
oldest_article = 2 |
| 24 |
max_articles_per_feed = 100 |
| 25 |
no_stylesheets = True |
| 26 |
use_embedded_content = False |
| 27 |
encoding = 'utf-8' |
| 28 |
language = 'en_US' |
| 29 |
|
| 30 |
keep_only_tags = [classes('article-header featured-media article-body')] |
| 31 |
remove_tags = [classes('most-read-container native-ad-article ad-container user-messaging')] |
| 32 |
|
| 33 |
feeds = [ |
| 34 |
('Local News', 'https://www.seattletimes.com/seattle-news/feed/'), |
| 35 |
('Nation & World', 'https://www.seattletimes.com/nation-world/feed/'), |
| 36 |
('Business', 'https://www.seattletimes.com/business/feed/'), |
| 37 |
('Sports', 'https://www.seattletimes.com/sports/feed/'), |
| 38 |
('Entertainment', 'https://www.seattletimes.com/entertainment/feed/'), |
| 39 |
('Life', 'https://www.seattletimes.com/life/feed/'), |
| 40 |
('Opinion', 'https://www.seattletimes.com/opinion/feed/'), |
| 41 |
('Photo and Video', 'https://www.seattletimes.com/photo-video/feed/'), |
| 42 |
] |
| 43 |
|
| 44 |
def get_browser(self): |
| 45 |
return BasicNewsRecipe.get_browser(self, user_agent='common_words/based') |