mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #786287 (Updated recipe for The Nation magazine)
This commit is contained in:
parent
9b52e0d4e8
commit
d4f79884a4
BIN
recipes/icons/the_nation.png
Normal file
BIN
recipes/icons/the_nation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 925 B |
@ -1,5 +1,5 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008 - 2010, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008 - 2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
thenation.com
|
thenation.com
|
||||||
'''
|
'''
|
||||||
@ -16,10 +16,17 @@ class Thenation(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
language = 'en'
|
language = 'en'
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
delay = 1
|
delay = 1
|
||||||
masthead_url = 'http://www.thenation.com/sites/default/themes/thenation/images/logo-main.gif'
|
masthead_url = 'http://www.thenation.com/sites/default/themes/thenation/images/logo-main.gif'
|
||||||
exra_css = ' body{font-family: Arial,Helvetica,sans-serif;} .print-created{font-size: small;} .caption{display: block; font-size: x-small;} '
|
login_url = 'http://www.thenation.com/user?destination=%3Cfront%3E'
|
||||||
|
publication_type = 'magazine'
|
||||||
|
needs_subscription = 'optional'
|
||||||
|
exra_css = """
|
||||||
|
body{font-family: Arial,Helvetica,sans-serif;}
|
||||||
|
.print-created{font-size: small;}
|
||||||
|
.caption{display: block; font-size: x-small;}
|
||||||
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
@ -28,13 +35,30 @@ class Thenation(BasicNewsRecipe):
|
|||||||
, 'language' : language
|
, 'language' : language
|
||||||
}
|
}
|
||||||
|
|
||||||
keep_only_tags = [ dict(attrs={'class':['print-title','print-created','print-content','print-links']}) ]
|
keep_only_tags = [dict(attrs={'class':['print-title','print-created','print-content','print-links']})]
|
||||||
remove_tags = [dict(name='link')]
|
remove_tags = [dict(name=['link','iframe','base','meta','object','embed'])]
|
||||||
|
remove_attributes = ['lang']
|
||||||
|
|
||||||
feeds = [(u"Editor's Picks", u'http://www.thenation.com/rss/editors_picks')]
|
feeds = [(u"Articles", u'http://www.thenation.com/rss/articles')]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url.replace('.thenation.com/','.thenation.com/print/')
|
return url.replace('.thenation.com/','.thenation.com/print/')
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def get_browser(self):
|
||||||
return self.adeify_images(soup)
|
br = BasicNewsRecipe.get_browser()
|
||||||
|
br.open('http://www.thenation.com/')
|
||||||
|
if self.username is not None and self.password is not None:
|
||||||
|
br.open(self.login_url)
|
||||||
|
br.select_form(nr=1)
|
||||||
|
br['name'] = self.username
|
||||||
|
br['pass'] = self.password
|
||||||
|
br.submit()
|
||||||
|
return br
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
soup = self.index_to_soup('http://www.thenation.com/issue/')
|
||||||
|
item = soup.find('div',attrs={'id':'cover-wrapper'})
|
||||||
|
if item:
|
||||||
|
return item.img['src']
|
||||||
|
return None
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user