View Single Post
Old 08-18-2010, 02:52 PM   #2459
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by TonytheBookworm View Post
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:
Spoiler:
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')]
The code looks OK to me.

Quote:
I get of course a list of links to the articles which is fine. But I want to get the actual articles as well.
I don't understand this part. I checked, and your feeds pull the articles fine. They also pull lots of other junk, but that's normal until you either remove that junk in the recipe, or use the recipe to pull the print version, which is designed to have less junk.

Quote:
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'm not sure why you say it's "dynamic" - it looks normally static to me.

Quote:
Code:
def print_version(self, url):
    return url.replace(url+'?printArticle=y')
is that even close to being right?
Not bad, but, as you said, you need to remove the material after the "?" before adding your string.

Here is code that I tested on a few of your links. It should work.
Code:
    def print_version(self, url):
        return url.partition('?')[0] +'?printArticle=y'

Last edited by Starson17; 08-18-2010 at 03:01 PM.
Starson17 is offline