View Single Post
Old 11-19-2010, 12:19 PM   #8
Nexus
Member
Nexus began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Nov 2010
Location: France
Device: PRS-600
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...
Nexus is offline   Reply With Quote