View Single Post
Old 02-06-2010, 05:02 AM   #14
Grimaud
Guru
Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.Grimaud could sell banana peel slippers to a Deveel.
 
Grimaud's Avatar
 
Posts: 748
Karma: 3000
Join Date: May 2009
Device: PRS-505, PRS-600, PRS-650
Il y a une balise code pour ce genre de situation
Code:
class AdvancedUserRecipe1265105283(BasicNewsRecipe):
    title = u'NOUVEL OBS SCIENCE'
     oldest_article = 20
    max_articles_per_feed = 100
    feeds = [(u'NOUVEL OBS SCIENCE', u'http://rss.nouvelobs.com/c/32262/f/437916/index.rss')]
def parse_index(self):
    articles = []
    soup = self.index_to_soup(self.INDEX)
    for item in soup.findAll('a', attrs={'class':'story_link_o'}):
        if item.has_key('href'):
            url = self.INDEX + item['href'].replace('action_id=2','action_id=100')
            title = self.tag_to_string(item)
            c_date = strftime('%A, %d %B, %Y')
            description = ''
            articles.append({
                'title':title,
                'date':c_date,
                'url':url,
                'description':description
        })
    return [(soup.head.title.string, articles)
ou php pour avoir un peu de couleurs Mais je sais pas si il met la couleur là ou il faut

PHP Code:
class AdvancedUserRecipe1265105283(BasicNewsRecipe):
    
title u'NOUVEL OBS SCIENCE'
     
oldest_article 20
    max_articles_per_feed 
100
    feeds 
= [(u'NOUVEL OBS SCIENCE'u'http://rss.nouvelobs.com/c/32262/f/437916/index.rss')]
def parse_index(self):
    
articles = []
    
soup self.index_to_soup(self.INDEX)
    for 
item in soup.findAll('a'attrs={'class':'story_link_o'}):
        if 
item.has_key('href'):
            
url self.INDEX item['href'].replace('action_id=2','action_id=100')
            
title self.tag_to_string(item)
            
c_date strftime('%A, %d %B, %Y')
            
description ''
            
articles.append({
                
'title':title,
                
'date':c_date,
                
'url':url,
                
'description':description
        
})
    return [(
soup.head.title.stringarticles
Grimaud is offline   Reply With Quote