View Single Post
Old 09-21-2010, 01:32 PM   #2785
TonytheBookworm
Addict
TonytheBookworm is on a distinguished road
 
TonytheBookworm's Avatar
 
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
Quote:
Originally Posted by noah View Post
I've been trying to get a custom recipe for The Bay Citizen to work. I've successfully created custom recipes for other sites, but this one is giving me problems.

I'm using this feed: http://www.baycitizen.org/feeds/stories/

I'm in "Basic Mode" and leaving all other settings at their defaults.

When I attempt to fetch this recipe, Calibre tells me "Failed: Fetch news from The Bay Citizen". The error output is too long to paste here, so I'm attaching it. I'm sorry, but I don't understand what's going on.
Post your recipe using spoiler tags and code tags and i will try and help.
Here you go... Please read the #'s (comments) in the code so you can get an understanding of what you needed to do.
Spoiler:

Code:
# this block is pretty much standard on all recipes
#----------------------------------------------------------------------------------------------------------
from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1282101454(BasicNewsRecipe):
    title = 'BayCitizen'
    language = 'en'
    __author__ = 'TonytheBookworm'
    description = 'BayCitizen'
    publisher = 'TonytheBookworm'
    category = 'news'
    oldest_article = 1 # USE THIS TO DETERMINE HOW FAR BACK YOU WANNA GO IN THE FEED DATE WISE
    max_articles_per_feed = 10 # USE TO DETERMINE HOW MANY ARTICLES YOU WISH TO READ PER FEED
    no_stylesheets = True # TURNS OFF JAVASCRIPT
      
    masthead_url = 'http://media.baycitizen.org/images/layout/logo1.png' #PUTS NICE LOGO ON KINDLE
#---------------------------------------------------------------------------------------------------------    
    
    #here we tell the recipe what feed(s) we wish to obtain
    #-----------------------------------------------------------------------------------------
    feeds          = [
                      ('Main Feed', 'http://www.baycitizen.org/feeds/stories/'),
                      
                    ]
    #------------------------------------------------------------------------------------------

    
    #since our articles have print version we want to use them to make it all nice and clean without 
    #all the junk. So we look and notice
    #orginial url: is for example: http://www.baycitizen.org/transportation/story/bart-board-challengers-hope-change/
    #print    url: is for example: http://www.baycitizen.org/transportation/story/bart-board-challengers-hope-change/print
    #
    #so what we need to do in this case is simple add /print to the end of the url like you see below
       
    def print_version(self, url):
        return url +'/print'

Last edited by TonytheBookworm; 09-21-2010 at 01:52 PM. Reason: posted code
TonytheBookworm is offline