View Single Post
Old 08-18-2010, 12:07 AM   #2453
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
I'm trying to learn how to make my own recipes. Trying to follow the tutorial but I'm a little lost. I downloaded a python editor and then entered the following code:
Code:
class AdvancedUserRecipe1282103072(BasicNewsRecipe):
    title          = u'AJC'
    oldest_article = 1
    max_articles_per_feed = 100
    no_stylesheets = True
    
    feeds          = [(u'Breaking News', u'http://www.ajc.com/genericList-rss.do?source=61499'), (u'News Q & A', u'http://www.ajc.com/genericList-rss.do?source=77197'), (u'Metro and Georgia', u'http://www.ajc.com/section-rss.do?source=news'), (u'Cobb County', u'http://www.ajc.com/section-rss.do?source=cobb'), (u'Opinion', u'http://www.ajc.com/section-rss.do?source=opinion')]
I get of course a list of links to the articles which is fine. But I want to get the actual articles as well. So I read a little more about using the print version() function. The question I have is how can I get the url to the print version since it is dynamic.

I thought maybe adding :
Code:
 
def get_article_url(self, article):

        url = article.get('guid', None)

        if 'podcasts' in url or 'surveys' in url:
            url = None

        return url
Then I want to convert the returned url from above lets say its spits back
http://www.ajc.com/news/atlanta/memo...rss_news_61499

I would assume I would want to use some form of a reg expression to trim everything after the ? and replace it with printArticle=y

but i'm confused cause this is all new to me

Code:
def print_version(self, url):
    return url.replace(url+'?printArticle=y')
is that even close to being right?

Any help would be appreciated...thank you so much..
TonytheBookworm is offline