Pull from trunk

This commit is contained in:
Kovid Goyal 2010-05-17 09:52:44 -06:00
commit 58f81309f2
3 changed files with 13 additions and 14 deletions

View File

@ -1,11 +1,10 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
__copyright__ = '2009-2010, Darko Miletic <darko.miletic at gmail.com>'
'''
www.instapaper.com
'''
import urllib
from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
@ -22,18 +21,15 @@ class Instapaper(BasicNewsRecipe):
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
remove_javascript = True
needs_subscription = True
INDEX = u'http://www.instapaper.com'
LOGIN = INDEX + u'/user/login'
html2lrf_options = [
'--comment', description
, '--category', category
, '--publisher', publisher
]
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"'
conversion_options = {
'comment' : description
, 'tags' : category
, 'publisher' : publisher
}
feeds = [
(u'Unread articles' , INDEX + u'/u' )
@ -63,7 +59,7 @@ class Instapaper(BasicNewsRecipe):
description = self.tag_to_string(item.div)
atag = item.a
if atag and atag.has_key('href'):
url = self.INDEX + atag['href'] + '/text'
url = atag['href']
title = self.tag_to_string(atag)
date = strftime(self.timefmt)
articles.append({
@ -75,3 +71,6 @@ class Instapaper(BasicNewsRecipe):
totalfeeds.append((feedtitle, articles))
return totalfeeds
def print_version(self, url):
return self.INDEX + '/text?u=' + urllib.quote(url)

View File

@ -23,7 +23,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
no_javascript = True
needs_subscription = True
keep_only_tags = [dict(id='article-body')]
keep_only_tags = [dict(id=['article-body','page-title'])]
remove_tags = [dict(attrs={'class':['article-tools', 'article-links',
'center advertisement']})]

View File

@ -21,7 +21,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
no_stylesheets = True
no_javascript = True
keep_only_tags = [dict(id='article-body')]
keep_only_tags = [dict(id=['article-body', 'page-title'])]
remove_tags = [dict(attrs={'class':['article-tools', 'article-links',
'center advertisement']})]