Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 02-13-2021, 11:53 PM   #1
nyy27wc
Junior Member
nyy27wc began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Dec 2012
Device: Kindle
Can't fix instapaper recipe

The instapaper built-in recipe won't give me more than the last 40 articles. I believe the problem could be that instapaper only puts 40 articles on each page at their site and the next ones are on subsequent pages.

So I tried editing the built-in recipe. I made 2 changes: (1) I added more pages to the feeds area and (2) I increased the maximum articles up to 1000.

But then when I hit save, I get the following error: "Invalid recipe" "Failed to compile the recipe with syntax error: 'tuple' object is not callable"

Here is what the complete revised recipe looks like:
Code:
# Calibre recipe for Instapaper.com (Stable version)
#
# Homepage: http://khromov.wordpress.com/project...alibre-recipe/
# Source: https://github.com/kovidgoyal/calibr...tapaper.recipe

from calibre.web.feeds.news import BasicNewsRecipe


class AdvancedUserRecipe1299694372(BasicNewsRecipe):
    title = u'Instapaper multiple'
    __author__ = 'Darko Miletic, Stanislav Khromov, Jim Ramsay'
    publisher = 'Instapaper.com'
    category = 'info, custom, Instapaper'
    oldest_article = 365
    max_articles_per_feed = 100
#    reverse_article_order = True
    no_stylesheets = False
    extra_css = 'q { font-style: italic; } .size3mode { color: black; }'
    remove_javascript = True
    remove_tags = [
        dict(name='div', attrs={'id': 'text_controls_toggle'}),
        dict(name='script'),
        dict(name='div', attrs={'id': 'text_controls'}),
        dict(name='section', attrs={'class': 'primary_bar'}),
        dict(name='div', attrs={'class': 'modal_group'}),
        dict(name='div', attrs={'id': 'editing_controls'}),
        dict(name='div', attrs={'class': 'modal_name'}),
        dict(name='div', attrs={'class': 'highlight_popover'}),
        dict(name='div', attrs={'class': 'bar bottom'}),
        dict(name='div', attrs={'class': 'evernote_confirm'}),
        dict(name='div', attrs={'id': 'controlbar_container'}),
        dict(name='div', attrs={'id': 'footer'}),
        dict(name='div', attrs={'id': 'speedRead'}),
        dict(name='label')
    ]
    use_embedded_content = False
    needs_subscription = True
    INDEX = u'https://www.instapaper.com'
    LOGIN = INDEX + u'/user/login'

    feeds = [
        (u'Instapaper Unread 1', u'https://www.instapaper.com/u')
        (u'Instapaper Unread 2', u'https://www.instapaper.com/u/2')
        (u'Instapaper Unread 3', u'https://www.instapaper.com/u/3')
        (u'Instapaper Unread 4', u'https://www.instapaper.com/u/4')
        (u'Instapaper Unread 5', u'https://www.instapaper.com/u/5')
        #            (u'Instapaper Starred', u'https://www.instapaper.com/starred')
    ]

    def get_browser(self):
        br = BasicNewsRecipe.get_browser(self)
        if self.username is not None:
            br.open(self.LOGIN)
            br.select_form(nr=0)
            br['username'] = self.username
            if self.password is not None:
                br['password'] = self.password
            br.submit()
        return br

    def parse_index(self):
        totalfeeds = []
        lfeeds = self.get_feeds()
        for feedobj in lfeeds:
            feedtitle, feedurl = feedobj
            self.report_progress(0, 'Fetching feed' + ' %s...' %
                                 (feedtitle if feedtitle else feedurl))
            articles = []
            soup = self.index_to_soup(feedurl)
            for item in soup.findAll('a', attrs={'class': 'article_title'}):
                articles.append({
                    'url': 'https://www.instapaper.com' + item['href'],
                    'title': item['title']
                })
            totalfeeds.append((feedtitle, articles))
        return totalfeeds


calibre_most_common_ua = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36'
How should I fix the recipe so I can get the subsequent pages and not get the error?

Last edited by PeterT; 02-14-2021 at 07:56 AM.
nyy27wc is offline   Reply With Quote
Old 03-10-2021, 07:47 PM   #2
sgillf
Junior Member
sgillf began at the beginning.
 
Posts: 4
Karma: 10
Join Date: Jul 2019
Device: Nova
Just to let you know, I'm looking for a fix to the same issue.
sgillf is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Instapaper Recipe haroldtreen Recipes 9 05-27-2025 06:10 PM
Instapaper recipe issue & fix mrabbitt Recipes 2 10-05-2016 01:28 AM
Instapaper - Updated recipe khromov Recipes 78 01-23-2015 01:09 AM
Instapaper recipe - broken by site redesign? adfadfsasdfafafd Recipes 11 06-02-2014 08:31 AM
Instapaper recipe not working as of this week largeboulder Recipes 7 09-04-2013 02:59 AM


All times are GMT -4. The time now is 01:28 AM.


MobileRead.com is a privately owned, operated and funded community.