mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Updated recipes for Harpers Magazine
This commit is contained in:
parent
7dd7ad65dd
commit
79f15cd010
@ -6,6 +6,7 @@ __copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||
harpers.org
|
||||
'''
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import Tag
|
||||
|
||||
class Harpers(BasicNewsRecipe):
|
||||
title = u"Harper's Magazine"
|
||||
@ -18,7 +19,6 @@ class Harpers(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
remove_javascript = True
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
@ -31,10 +31,18 @@ class Harpers(BasicNewsRecipe):
|
||||
|
||||
keep_only_tags = [ dict(name='div', attrs={'id':'cached'}) ]
|
||||
remove_tags = [
|
||||
dict(name='table', attrs={'class':'rcnt'})
|
||||
,dict(name='table', attrs={'class':'rcnt topline'})
|
||||
dict(name='table', attrs={'class':['rcnt','rcnt topline']})
|
||||
,dict(name=['link','object','embed'])
|
||||
]
|
||||
|
||||
feeds = [(u"Harper's Magazine", u'http://www.harpers.org/rss/frontpage-rss20.xml')]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
||||
soup.head.insert(1,mcharset)
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
for item in soup.findAll(xmlns=True):
|
||||
del item['xmlns']
|
||||
return soup
|
||||
|
||||
|
@ -9,8 +9,8 @@ images and pdf's are ignored
|
||||
'''
|
||||
|
||||
from calibre import strftime
|
||||
|
||||
from calibre.web.feeds.news import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import Tag
|
||||
|
||||
class Harpers_full(BasicNewsRecipe):
|
||||
title = u"Harper's Magazine - articles from printed edition"
|
||||
@ -22,14 +22,12 @@ class Harpers_full(BasicNewsRecipe):
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
use_embedded_content = False
|
||||
simultaneous_downloads = 1
|
||||
delay = 1
|
||||
language = _('English')
|
||||
needs_subscription = True
|
||||
INDEX = strftime('http://www.harpers.org/archive/%Y/%m')
|
||||
LOGIN = 'http://www.harpers.org'
|
||||
cover_url = strftime('http://www.harpers.org/media/pages/%Y/%m/gif/0001.gif')
|
||||
remove_javascript = True
|
||||
|
||||
html2lrf_options = [
|
||||
'--comment', description
|
||||
@ -41,8 +39,8 @@ class Harpers_full(BasicNewsRecipe):
|
||||
|
||||
keep_only_tags = [ dict(name='div', attrs={'id':'cached'}) ]
|
||||
remove_tags = [
|
||||
dict(name='table', attrs={'class':'rcnt'})
|
||||
,dict(name='table', attrs={'class':'rcnt topline'})
|
||||
dict(name='table', attrs={'class':['rcnt','rcnt topline']})
|
||||
,dict(name='link')
|
||||
]
|
||||
|
||||
def get_browser(self):
|
||||
@ -73,3 +71,11 @@ class Harpers_full(BasicNewsRecipe):
|
||||
})
|
||||
return [(soup.head.title.string, articles)]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
||||
soup.head.insert(1,mcharset)
|
||||
for item in soup.findAll(style=True):
|
||||
del item['style']
|
||||
for item in soup.findAll(xmlns=True):
|
||||
del item['xmlns']
|
||||
return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user