View Single Post
Old 07-29-2010, 08:28 PM   #2365
sark666
Connoisseur
sark666 began at the beginning.
 
Posts: 51
Karma: 10
Join Date: Jul 2010
Device: colognesbook
I'm trying to make my first recipe but I can't see why this isn't working:

Code:
class AdvancedUserRecipe1280289069(BasicNewsRecipe):
    title          = u'Metro Daily'
    oldest_article = 7
    max_articles_per_feed = 100

    feeds          = [(u'metro local', u'http://www.metronews.ca/Toronto/local/rss')]

    def print_version(self, url):
        baseurl='http://www.metronews.ca/ArticlePrint/' 
        split1 = string.split(url,"/")
        xxx=split1 [6]
        split2= xxx[0:5]
        s =  baseurl + split2
        return s
It's from metronews, a Canadian daily news publication.

A url story would look like:

"http://www.metronews.ca/toronto/local/article/587467--finally-someone-at-the-acc-does-well"

But you can just have the 6 digit identifer. And the print equivalent would be:

"http://www.metronews.ca/ArticlePrint/587467?language=en"

But you only need the 6 digit identifer. At first I was adding the language bit, but when it wasn't working I removed it.

I tried it as str.split and string.split. Can't see where else it's wrong.
sark666 is offline