View Single Post
Old 11-19-2010, 12:32 PM   #9
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 Nexus View Post
Thanks for the help Starson17. That's not bad will on my side, but python is mumbo jumbo to me.


I think this is the tricky part for me, I'm not sure what to do.

Code:
            
    def make_links(self, url):
        soup = self.index_to_soup(url)
        title = ''
        date = ''
        current_articles = []
        soup = self.index_to_soup(url)
        recipes = soup.findAll('div', attrs={'class': 'date-outer'})
I have difficulties to see what tag I have to use, and most of all where I grab it (http://tsn.ca/nhl/story/?id=nhl) or article page? <div id= tsnColWrap> and <div id = tsnMain> appear on both pages, and div class = feature> only on the "main page" (...story/?id=nhl)

Code:
for recipe in recipes:
            title = recipe.h3.a.string
            page_url = recipe.h3.a['href']
            current_articles.append({'title': title, 'url': page_url, 'description':'', 'date':date})
        return current_articles
And there goes my mental health...

I have to modify the "title" and "page_url" line right? But same as above, I'm not sure where to look at and what to put there. Tried different things, got error messages each time. By the way, I added "from calibre.ebooks.BeautifulSoup import BeautifulSoup" at the begining of the recipe, I think I have to call that in order to make it work.

I'm a lost cause...
I'll walk you through it, (if no one else does it first), but I'm a bit busy now, so I'll give it to you in dribs/drabs.

Start with the parse_feeds. I looked at your page. I think I was wrong when I said you want one feed. I'd use one feed per day, then put the articles for that day under that feed. Let's do this. You put together as much of the recipe as you can, and post it. I'll look it over. You should have enough to do just the parse_feeds part. Post that, with the rest of your recipe. Then I'll help with the make_links. Post your best shot on that too.

You may want to install FireBug in FireFox if you haven't done it yet. Yes, you needed to import BeautifulSoup.
Starson17 is offline   Reply With Quote