mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Pull from trunk
This commit is contained in:
commit
58f81309f2
@ -1,11 +1,10 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__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
|
www.instapaper.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import urllib
|
||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
@ -22,18 +21,15 @@ class Instapaper(BasicNewsRecipe):
|
|||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
remove_javascript = True
|
|
||||||
needs_subscription = True
|
needs_subscription = True
|
||||||
INDEX = u'http://www.instapaper.com'
|
INDEX = u'http://www.instapaper.com'
|
||||||
LOGIN = INDEX + u'/user/login'
|
LOGIN = INDEX + u'/user/login'
|
||||||
|
|
||||||
html2lrf_options = [
|
conversion_options = {
|
||||||
'--comment', description
|
'comment' : description
|
||||||
, '--category', category
|
, 'tags' : category
|
||||||
, '--publisher', publisher
|
, '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}"'
|
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Unread articles' , INDEX + u'/u' )
|
(u'Unread articles' , INDEX + u'/u' )
|
||||||
@ -63,7 +59,7 @@ class Instapaper(BasicNewsRecipe):
|
|||||||
description = self.tag_to_string(item.div)
|
description = self.tag_to_string(item.div)
|
||||||
atag = item.a
|
atag = item.a
|
||||||
if atag and atag.has_key('href'):
|
if atag and atag.has_key('href'):
|
||||||
url = self.INDEX + atag['href'] + '/text'
|
url = atag['href']
|
||||||
title = self.tag_to_string(atag)
|
title = self.tag_to_string(atag)
|
||||||
date = strftime(self.timefmt)
|
date = strftime(self.timefmt)
|
||||||
articles.append({
|
articles.append({
|
||||||
@ -75,3 +71,6 @@ class Instapaper(BasicNewsRecipe):
|
|||||||
totalfeeds.append((feedtitle, articles))
|
totalfeeds.append((feedtitle, articles))
|
||||||
return totalfeeds
|
return totalfeeds
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return self.INDEX + '/text?u=' + urllib.quote(url)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
|
|||||||
no_javascript = True
|
no_javascript = True
|
||||||
needs_subscription = 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',
|
remove_tags = [dict(attrs={'class':['article-tools', 'article-links',
|
||||||
'center advertisement']})]
|
'center advertisement']})]
|
||||||
|
|
||||||
|
@ -21,7 +21,7 @@ class NewYorkReviewOfBooks(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
no_javascript = 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',
|
remove_tags = [dict(attrs={'class':['article-tools', 'article-links',
|
||||||
'center advertisement']})]
|
'center advertisement']})]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user