| 1 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 2 |
|
| 3 |
|
| 4 |
def classes(classes): |
| 5 |
q = frozenset(classes.split(' ')) |
| 6 |
return dict(attrs={'class': lambda x: x and frozenset(x.split()).intersection(q)}) |
| 7 |
|
| 8 |
|
| 9 |
class JerusalemPost(BasicNewsRecipe): |
| 10 |
title = 'Jerusalem Post' |
| 11 |
description = 'News from Israel and the Middle East' |
| 12 |
use_embedded_content = False |
| 13 |
language = 'en' |
| 14 |
keep_only_tags = [ |
| 15 |
classes('margin-container-body article-title article-subline article-inner-content-breaking-news'), |
| 16 |
] |
| 17 |
remove_tags = [ |
| 18 |
classes('share-buttons hide-for-premium'), |
| 19 |
] |
| 20 |
remove_attributes = ['style'] |
| 21 |
no_stylesheets = True |
| 22 |
|
| 23 |
__author__ = 'Kovid Goyal' |
| 24 |
max_articles_per_feed = 10 |
| 25 |
|
| 26 |
def get_browser(self): |
| 27 |
return BasicNewsRecipe.get_browser(self, user_agent='common_words/based') |
| 28 |
|
| 29 |
feeds = [ |
| 30 |
('Top Stories', 'https://www.jpost.com/Rss/RssFeedsHeadlines.aspx'), |
| 31 |
('Arab Israeli Conflict', 'https://www.jpost.com/rss/rssfeedsarabisraeliconflict.aspx'), |
| 32 |
('US Politics', 'https://www.jpost.com/rss/rssfeedsamerican-politics'), |
| 33 |
('Israel News', 'https://www.jpost.com/rss/rssfeedsisraelnews.aspx'), |
| 34 |
('Middle East News', 'https://www.jpost.com/rss/rssfeedsmiddleeastnews.aspx'), |
| 35 |
('International News', 'https://www.jpost.com/rss/rssfeedsinternational'), |
| 36 |
('Opinion', 'https://www.jpost.com/Rss/RssFeedsOpinion.aspx'), |
| 37 |
] |