Fix Instapaper

This commit is contained in:
Kovid Goyal 2010-05-17 09:47:23 -06:00
parent 3b3a3d888b
commit e1b988598c

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)