View Single Post
Old 03-02-2010, 06:08 PM   #1525
jrollmorton
Junior Member
jrollmorton began at the beginning.
 
jrollmorton's Avatar
 
Posts: 3
Karma: 10
Join Date: Feb 2010
Location: Vancouver, BC, Canada
Device: Amazon Kindle, iPhone
The Walrus magazine - recipe

Quote:
Originally Posted by Starson17 View Post
OK, I tried it, and it seemed like it worked as I expected. Here's the basic recipe I tried. It only has two things in it, the RSS feed and my suggested replacement:
This worked beautifully! Nice clean text, nicely rendered images and mastheads. Couldn't ask for a better overall appearance.

I ran it a few times and encountered errors ... the fetch process could not complete after labouring away for 2.5-3 minutes.

I corrected some indentation errors (as a result of my copy/paste job). But only when I removed the first four lines of your code did I get the desired result:

Quote:
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
Now I realize this might not be ideal for Kovid, whose name is stripped out of my recipe, now. I can't see errors in the above lines, but when they are in the recipe, I don't get results. If you can suggest a way to re-insert this information, I certainly will. Credit where credit is due!

So the successful recipe is:

Spoiler:
from calibre.web.feeds.news import BasicNewsRecipe

class Walrus(BasicNewsRecipe):
title = u'The_Walrus'
__author__ = 'Starson17'
description = 'The_Walrus'
language = 'en'
use_embedded_content = False
no_stylesheets = True
remove_javascript = True
recursions = 0
oldest_article = 90

def print_version(self, url):
return url.replace('articles', 'print')

feeds = [
(u'Main', u'http://feeds.feedburner.com/WalrusFeatureArticles')
]


(I also changed the recursions value to '0').

Thank you for doing this, Starson17! The recipe has rendered a great version of the magazine, and it was very instructive for me to see how to import the BasicNewsRecipe and play with some of the variables. When I have a little more time, I will try to adapt some more news recipes!

Cheers!
jrollmorton is offline