mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update MSNBC
This commit is contained in:
parent
8b0ae7bde2
commit
b6236975ec
@ -7,10 +7,16 @@ msnbc.msn.com
|
|||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
|
|
||||||
|
|
||||||
|
def classes(classes):
|
||||||
|
q = frozenset(classes.split(' '))
|
||||||
|
return dict(attrs={
|
||||||
|
'class': lambda x: x and frozenset(x.split()).intersection(q)})
|
||||||
|
|
||||||
|
|
||||||
class MsNBC(BasicNewsRecipe):
|
class MsNBC(BasicNewsRecipe):
|
||||||
title = 'msnbc.com'
|
title = 'MSNBC'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'A Fuller Spectrum of News'
|
description = 'A Fuller Spectrum of News from msnbc.com and nbcnews.com'
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
@ -21,27 +27,23 @@ class MsNBC(BasicNewsRecipe):
|
|||||||
remove_empty_feeds = True
|
remove_empty_feeds = True
|
||||||
ignore_duplicate_articles = {'title', 'url'}
|
ignore_duplicate_articles = {'title', 'url'}
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(itemprop='headline'),
|
classes('article-hero__container article-body')
|
||||||
dict(attrs={'class': lambda x: x and set(x.split()).intersection(
|
|
||||||
{'byline_article', 'article_main'})}),
|
|
||||||
dict(attrs={'class': lambda x: x and set(x.split()).intersection(
|
|
||||||
{'authors-names', 'pane-node-body'})}),
|
|
||||||
]
|
]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['iframe', 'button', 'meta', 'link']),
|
dict(name=['iframe', 'button', 'meta', 'link']),
|
||||||
dict(attrs={'class': lambda x: x and set(
|
classes('widget_video ad-container related'),
|
||||||
x.split()).intersection({'widget_video', 'ad-container'})}),
|
dict(attrs={'data-test': ['social-share-inline']}),
|
||||||
|
dict(name='source'),
|
||||||
]
|
]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
|
('Latest', 'https://feeds.nbcnews.com/msnbc/public/news'),
|
||||||
('Latest', 'http://www.msnbc.com/feeds/latest'),
|
('Top stories', 'https://feeds.nbcnews.com/nbcnews/public/news'),
|
||||||
|
('Politics', 'https://feeds.nbcnews.com/nbcnews/public/politics'),
|
||||||
(u'US News', u'http://rss.msnbc.msn.com/id/3032524/device/rss/rss.xml'),
|
('U.S. News', 'https://feeds.nbcnews.com/nbcnews/public/us-news'),
|
||||||
(u'Politics', u'http://rss.msnbc.msn.com/id/3032552/device/rss/rss.xml'),
|
('World', 'https://feeds.nbcnews.com/nbcnews/public/world'),
|
||||||
(u'Business', u'http://rss.msnbc.msn.com/id/3032071/device/rss/rss.xml'),
|
('Business', 'https://feeds.nbcnews.com/nbcnews/public/business'),
|
||||||
(u'Health', u'http://rss.msnbc.msn.com/id/3088327/device/rss/rss.xml'),
|
('Opinion', 'https://feeds.nbcnews.com/nbcnews/public/think'),
|
||||||
(u'Tech & Science', u'http://rss.msnbc.msn.com/id/3032117/device/rss/rss.xml')
|
|
||||||
]
|
]
|
||||||
|
|
||||||
def get_article_url(self, article):
|
def get_article_url(self, article):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user