Update Wired Daily Edition. Fixes #1357792 [Updated recipe for Wired Daily](https://bugs.launchpad.net/calibre/+bug/1357792)

This commit is contained in:
Kovid Goyal 2014-08-17 08:21:21 +05:30
parent 110dfad9d1
commit 240fe4bef2
2 changed files with 68 additions and 36 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 492 B

View File

@ -1,45 +1,77 @@
#!/usr/bin/env python
__license__ = 'GPL v3' __license__ = 'GPL v3'
__docformat__ = 'restructuredtext en' __copyright__ = '2014, Darko Miletic <darko.miletic at gmail.com>'
'''
www.wired.com
'''
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Wired_Daily(BasicNewsRecipe): class WiredDailyNews(BasicNewsRecipe):
title = 'Wired Daily Edition'
__author__ = 'Darko Miletic'
description = 'Wired is a full-color monthly American magazine, published in both print and online editions, that reports on how emerging technologies affect culture, the economy and politics.'
publisher = 'Conde Nast'
category = 'news, IT, computers, technology'
oldest_article = 2
max_articles_per_feed = 200
no_stylesheets = True
encoding = 'utf-8'
use_embedded_content = False
language = 'en'
ignore_duplicate_articles = {'url'}
remove_empty_feeds = True
publication_type = 'newsportal'
masthead_url = 'http://www.wired.com/images/home/wired_logo.gif'
extra_css = """
.entry-header{
text-transform: uppercase;
vertical-align: baseline;
display: inline;
}
ul li{display: inline}
"""
title = 'Wired Daily Edition' conversion_options = {
__author__ = 'Kovid Goyal' 'comment' : description
description = 'Technology news' , 'tags' : category
timefmt = ' [%Y%b%d %H%M]' , 'publisher' : publisher
language = 'en' , 'language' : language
use_embedded_content = False }
no_stylesheets = True
keep_only_tags = [ # dict(name= 'div', id ='liveblog-hdr'), remove_tags = [
dict(name='div', attrs={'class': 'post'})] dict(name=['meta','link']),
dict(name='div', attrs={'class':'podcast_storyboard'})
remove_tags = [dict(name='div', attrs={'class': 'social-top'})] ]
keep_only_tags=[
dict(name='h1' , attrs={'id' :'headline' }),
dict(name='ul' , attrs={'class':'entry-header'}),
dict(name='div', attrs={'class':'entry' })
]
feeds = [ feeds = [
('Top News', 'http://feeds.wired.com/wired/index'), (u'Top Stories' , u'http://feeds.wired.com/wired/index' )
('Product Reviews', ,(u'Product reviews' , u'http://feeds.wired.com/WiredReviews' )
'http://www.wired.com/reviews/feeds/latestProductsRss'), ,(u'Autopia' , u'http://feeds.wired.com/wiredautopia' )
('Autopia', 'http://www.wired.com/autopia/feed/'), ,(u'Business' , u'http://feeds.wired.com/wiredbusinessblog')
('Danger Room', 'http://www.wired.com/dangerroom/feed/'), ,(u'Danger Room' , u'http://feeds.wired.com/WiredDangerRoom' )
('Epicenter', 'http://www.wired.com/epicenter/feed/'), ,(u'Gadget Lab' , u'http://feeds.wired.com/GearFactor' )
('Gadget Lab', 'http://www.wired.com/gadgetlab/feed/'), ,(u'Game Life' , u'http://feeds.wired.com/Gamelife' )
('Geek Dad', 'http://www.wired.com/geekdad/feed/'), ,(u'GeekMom' , u'http://feeds.wired.com/wiredgeekmom/' )
('Playbook', 'http://www.wired.com/playbook/feed/'), ,(u'Innovation Insights', u'http://feeds.wired.com/wiredinsights' )
('Rawfile', 'http://www.wired.com/rawfile/feed/'), ,(u'Opinion' , u'http://feeds.wired.com/wiredopinion/' )
('This Day in Tech', 'http://www.wired.com/thisdayintech/feed/'), ,(u'Playbook' , u'http://feeds.wired.com/wiredplaybook/' )
('Threat Level', 'http://www.wired.com/threatlevel/feed/'), ,(u'This day in Tech' , u'http://feeds.wired.com/ThisDayInTech' )
('Underwire', 'http://www.wired.com/underwire/feed/'), ,(u'Threat level' , u'http://feeds.wired.com/wired27b' )
('Web Monkey', 'http://www.webmonkey.com/feed/'), ,(u'Design' , u'http://feeds.wired.com/wired/design' )
('Science', 'http://www.wired.com/wiredscience/feed/'), ,(u'Underwire' , u'http://feeds.wired.com/wiredunderwire' )
] ,(u'Enterprise' , u'http://feeds.wired.com/wiredenterprise/' )
,(u'Science' , u'http://feeds.wired.com/wiredscience' )
]
def preprocess_html(self, soup): def get_article_url(self, article):
for img in soup.findAll('img', attrs={'data-lazy-src':True}): url = article.get('guid', None)
img['src'] = img['data-lazy-src'] try:
return soup return self.browser.open_novisit(url).geturl() # resolve redirect.
except:
return url