View Single Post
Old 09-02-2010, 03:11 PM   #2596
bmsleight
Member
bmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enoughbmsleight will become famous soon enough
 
Posts: 24
Karma: 540
Join Date: Aug 2010
Device: Kindle 3
Hi c.espinosas,

Try this for a recipe for Milenio Diario (mexican newspaper, http://impreso.milenio.com/Nacional/)

Although I do not speak Spanish, so there maybe some errors.

Spoiler:
Code:
#!/usr/bin/env  python
__license__   = 'GPL v3'
__copyright__ = '2010, Brendan Sleight <bms.calibre at barwap.com>'
'''
impreso.milenio.com
'''
from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup

import datetime
import string

class Milenio(BasicNewsRecipe):
    title                 = u'Milenio-diario'
    __author__            = 'Bmsleight'
    description           = 'Milenio-diario'
    oldest_article        = 10
    max_articles_per_feed = 100
    no_stylesheets        = False
    index                 = 'http://impreso.milenio.com'

    keep_only_tags      = [
                           dict(name='div', attrs={'class':'content'})
                          ]

    def parse_index(self):
        # "%m/%d/%Y"
        # http://impreso.milenio.com/Nacional/2010/09/01/
        totalfeeds = []
        soup   = self.index_to_soup(self.index + "/Nacional/" + datetime.date.today().strftime("%Y/%m/%d"))
        maincontent = soup.find('div',attrs={'class':'content'})
        mfeed = []
        if maincontent:
            for itt in maincontent.findAll('a',href=True):
                if "/node/" in str(itt['href']):
                    url   = self.index + itt['href']
                    title = self.tag_to_string(itt)
                    description = ''
                    date  = strftime(self.timefmt)
                    mfeed.append({
                                  'title'      :title
                                 ,'date'       :date
                                 ,'url'        :url
                                 ,'description':description
                                })
        totalfeeds.append(('Articles', mfeed))
        return totalfeeds


Anyone help me on https://www.mobileread.com/forums/sho...postcount=2568 (instructable) ?

Regards,
Brendan
bmsleight is offline