02-29-2012, 05:25 PM | #46 |
Member
Posts: 10
Karma: 10
Join Date: Dec 2010
Device: none
|
went ahead and posted the whole recipe maybe you can show me where i am supposed to be adding it. Im sure that is what the issue is. Bold is the line I added I have other folders to add but thats the only one ive tried. Thanks and sorry for the numerous posts.
import urllib, sys from calibre import strftime from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1299694372(BasicNewsRecipe): title = u'Instapaper' __author__ = 'Darko Miletic, Stanislav Khromov' publisher = 'Instapaper.com' category = 'info, custom, Instapaper' feeds = [] #if all feeds are empty, no periodical will be generated remove_empty_feeds = True # - Recipe configuration - # #Set archive to True if you want to auto-archive items archive = False #Set include_liked to true if you want to include liked items in your feed. #Warning: Please avoid enabling this in conjunction with auto-archive. include_liked = False #Set to true if you want to reverse article order reverse_article_order = False #Set the maximum amount of articles you'd like to receive here max_articles_per_feed = 30 #Set your own custom folders here, simply re-paste the example line below for each new folder you need #Example: #feeds+=[(u'My custom folder', u'http://www.instapaper.com/u/folder/1321400/my-custom-folder')] #feeds+=[(u'Long-term reading', u'http://www.instapaper.com/u/folder/1232089/long-term-reading')] feeds+=[(u'Genesis Reviews', u'http://www.instapaper.com/u/folder/1538365/genesis-reviews')] # - End of recipe configuration - # oldest_article = 0 no_stylesheets = True 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='div', attrs={'id':'editing_controls'}) ,dict(name='div', attrs={'class':'bar bottom'}) ,dict(name='div', attrs={'id':'controlbar_container'}) ,dict(name='div', attrs={'id':'footer'}) ] use_embedded_content = False needs_subscription = True INDEX = u'http://www.instapaper.com' LOGIN = INDEX + u'/user/login' if include_liked: feeds = feeds+[(u'Instapaper Liked', u'http://www.instapaper.com/starred')] feeds = feeds+[(u'Instapaper Unread', u'http://www.instapaper.com/u')] feeds.reverse() cleanup_items = [] def get_browser(self): br = BasicNewsRecipe.get_browser() 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 = [] #folder page current_page = 1 #so we run the first time articles_on_page = 1 while articles_on_page>0: soup = self.index_to_soup(feedurl+u'/'+str(current_page)) #get and count number of items on current page items = soup.findAll('a', attrs={'class':'actionButton textButton'}) cleanup = soup.findAll('a', attrs={'class':'actionButton archiveButton'}) #Add cleanup items for clean_item in cleanup: self.cleanup_items.append(clean_item); articles_on_page = len(items) # Add each item for item in items: description = self.tag_to_string(item.div) #print atag #sys.exit() if item and item.has_key('href'): url = item['href'] articles.append({ 'url' :url }) current_page+=1 #Don't append empty feeds if len(articles)!=0: totalfeeds.append((feedtitle, articles)) if len(totalfeeds)==0: return None else: return totalfeeds def print_version(self, url): return 'http://www.instapaper.com' + url def populate_article_metadata(self, article, soup, first): #adds the title to the metadata article.title = soup.find('title').contents[0].strip() def postprocess_html(self, soup, first_fetch): #adds the title to each story, as it is not always included for link_tag in soup.findAll(attrs={"id" : "story"}): link_tag.insert(0,'<h1>'+soup.find('title').conten ts[0].strip()+'</h1>') #print repr(soup) return soup def cleanup(self): if self.archive: self.report_progress(0, "Archiving articles...") # Clean up each item for cleanup_item in self.cleanup_items: self.report_progress(0, "Cleaning up... : " + self.INDEX+cleanup_item['href']) self.browser.open(self.INDEX+cleanup_item['href']); |
02-29-2012, 06:04 PM | #47 |
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
The folder looks correct and is in the proper position.
Python is a language that requires indentation of the code. Indentation is done by pressing the Tab key on your keyboard. Can you please try opening the recipe file in a good text editor, like Notepad2: http://www.flos-freeware.ch/notepad2.html When you add the line for your folder, make sure to press the Tab button on your keyboard once before the line, like in this example: Let me know if this works for you! |
02-29-2012, 07:44 PM | #48 |
Member
Posts: 10
Karma: 10
Join Date: Dec 2010
Device: none
|
ok got it to work
tried it it notepad 2 with the tab still failed. Added a few spaces in calibre and it worked fine. Guess it has be in an exact spot. Im going to try and add a few more folders hopefully it wont break. Thanks for all your help |
02-29-2012, 09:33 PM | #49 | |
Grand Sorcerer
Posts: 12,160
Karma: 73448616
Join Date: Nov 2007
Location: Toronto
Device: Nexus 7, Clara, Touch, Tolino EPOS
|
Quote:
|
|
03-19-2012, 01:26 AM | #50 |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2012
Device: Kobo Touch
|
Is it possible to have the recipe optionally return Instapaper items as separate .epubs, rather than as a single collated .epub? I've started looking through the recipe code and whatnot, but nothing is jumping out at me…
|
03-22-2012, 05:59 PM | #51 | |
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
Quote:
However, may I suggest the "Send to Kindle" bookmarklet that Readability provides: http://www.readability.com/bookmarklets |
|
03-22-2012, 11:27 PM | #52 | |
Junior Member
Posts: 2
Karma: 10
Join Date: Mar 2012
Device: Kobo Touch
|
Quote:
Thanks for the suggestion! |
|
06-01-2012, 07:29 PM | #53 | |
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
New stable and development versions out with fixes for some annoying issues!
Quote:
https://bitbucket.org/khromov/calibre-instapaper Download: https://bitbucket.org/khromov/calibr...get/master.zip |
|
06-15-2012, 02:27 PM | #54 |
Addict
Posts: 294
Karma: 1196776
Join Date: Nov 2008
Location: Bulgaria
Device: Kindle 4 NT, Onyx Boox M92
|
Where do I put in the recipe username and password?
|
06-15-2012, 04:22 PM | #55 |
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
|
06-15-2012, 05:23 PM | #56 |
Addict
Posts: 294
Karma: 1196776
Join Date: Nov 2008
Location: Bulgaria
Device: Kindle 4 NT, Onyx Boox M92
|
Thanks, it worked!
|
08-14-2012, 06:15 PM | #57 |
Junior Member
Posts: 5
Karma: 10
Join Date: Jul 2011
Device: Sony PRS-650
|
No joy
Hi,
I'm trying to get this recipe going, the stable version runs but just gives me an empty epub and the devel version gives the following error message, any ideas? Thanks Jonathan calibre, version 0.8.64 (win32, isfrozen: True) Conversion Error: Failed: Fetch news from Instapaper (devel) Fetch news from Instapaper (devel) Resolved conversion options calibre version: 0.8.64 {'asciiize': False, 'author_sort': None, 'authors': None, 'base_font_size': 0, 'book_producer': None, 'change_justification': 'original', 'chapter': None, 'chapter_mark': 'pagebreak', 'comments': None, 'cover': None, 'debug_pipeline': None, 'dehyphenate': True, 'delete_blank_paragraphs': True, 'disable_font_rescaling': False, 'dont_download_recipe': False, 'dont_split_on_page_breaks': True, 'duplicate_links_in_toc': False, 'enable_heuristics': False, 'epub_flatten': False, 'extra_css': None, 'extract_to': None, 'filter_css': None, 'fix_indents': True, 'flow_size': 260, 'font_size_mapping': None, 'format_scene_breaks': True, 'html_unwrap_factor': 0.4, 'input_encoding': None, 'input_profile': <calibre.customize.profiles.InputProfile object at 0x0436F990>, 'insert_blank_line': False, 'insert_blank_line_size': 0.5, 'insert_metadata': False, 'isbn': None, 'italicize_common_cases': True, 'keep_ligatures': False, 'language': None, 'level1_toc': None, 'level2_toc': None, 'level3_toc': None, 'line_height': 0, 'linearize_tables': False, 'lrf': False, 'margin_bottom': 5.0, 'margin_left': 5.0, 'margin_right': 5.0, 'margin_top': 5.0, 'markup_chapter_headings': True, 'max_toc_links': 50, 'minimum_line_height': 120.0, 'no_chapters_in_toc': False, 'no_default_epub_cover': False, 'no_inline_navbars': False, 'no_svg_cover': False, 'output_profile': <calibre.customize.profiles.SonyReader300Output object at 0x0436FE50>, 'page_breaks_before': None, 'prefer_metadata_cover': False, 'preserve_cover_aspect_ratio': False, 'pretty_print': True, 'pubdate': None, 'publisher': None, 'rating': None, 'read_metadata_from_opf': None, 'remove_fake_margins': True, 'remove_first_image': False, 'remove_paragraph_spacing': False, 'remove_paragraph_spacing_indent_size': 1.5, 'renumber_headings': True, 'replace_scene_breaks': '', 'search_replace': None, 'series': None, 'series_index': None, 'smarten_punctuation': False, 'sr1_replace': '', 'sr1_search': '', 'sr2_replace': '', 'sr2_search': '', 'sr3_replace': '', 'sr3_search': '', 'tags': None, 'test': False, 'timestamp': None, 'title': None, 'title_sort': None, 'toc_filter': None, 'toc_threshold': 6, 'unsmarten_punctuation': False, 'unwrap_lines': True, 'use_auto_toc': False, 'verbose': 2} InputFormatPlugin: Recipe Input running Python function terminated unexpectedly 'NoneType' object is not iterable (Error Code: 1) Traceback (most recent call last): File "site.py", line 132, in main File "site.py", line 109, in run_entry_point File "site-packages\calibre\utils\ipc\worker.py", line 192, in main File "site-packages\calibre\gui2\convert\gui_conversion.py", line 25, in gui_convert File "site-packages\calibre\ebooks\conversion\plumber.py", line 979, in run File "site-packages\calibre\customize\conversion.py", line 239, in __call__ File "site-packages\calibre\ebooks\conversion\plugins\recipe_ input.py", line 105, in convert File "site-packages\calibre\web\feeds\news.py", line 881, in download File "site-packages\calibre\web\feeds\news.py", line 1028, in build_index File "site-packages\calibre\web\feeds\__init__.py", line 340, in feeds_from_index TypeError: 'NoneType' object is not iterable |
08-15-2012, 11:38 AM | #58 |
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
Are you getting this consistently? Try removing your reading list (or get a new account and add just a couple items to it) and see if that helps. If you are still getting errors/empty output, please private message me your Instapaper account credentials so I can test the recipe on your account.
Last edited by khromov; 08-15-2012 at 11:41 AM. |
08-20-2012, 06:13 PM | #59 | |
Junior Member
Posts: 5
Karma: 10
Join Date: Jul 2011
Device: Sony PRS-650
|
Fixed
Quote:
Thanks for getting back to me, I was using my userid not my email as login credentials, as soon as I changed that it worked. However, should it not give an error such as invalid username/password if it can't login to Instapaper, also it still errors if there are no items to downlaod. I don't want an error message in that instance it should just silently exit. Any thoughts? Thanks Jonathan |
|
08-22-2012, 05:19 PM | #60 | ||
Connoisseur
Posts: 83
Karma: 499304
Join Date: Jul 2011
Device: Kindle
|
Quote:
Quote:
http://manual.calibre-ebook.com/cli/ebook-convert.html |
||
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Nature news - updated recipe | Alexis | Recipes | 3 | 10-05-2012 02:36 PM |
Recipe for National Geographic *Updated* | gagsays | Recipes | 3 | 05-19-2011 12:30 PM |
Updated Recipe: They Draw and Cook | Starson17 | Recipes | 0 | 03-13-2011 10:59 AM |
Updated recipe for Le Monde? | veezh | Recipes | 5 | 01-20-2011 09:06 PM |
One new recipe and other one updated (In Spanish) | desUBIKado | Recipes | 3 | 01-19-2011 03:58 AM |