from calibre.web.feeds.news import BasicNewsRecipe

class AdvancedUserRecipe1325766771(BasicNewsRecipe):
    title          = u'Macity'
    language = 'it'
    oldest_article = 7
    max_articles_per_feed = 100
    auto_cleanup = True

    def get_article_url(self, article):
        link = BasicNewsRecipe.get_article_url(self, article)
        if link.split('/')[-1]=="story01.htm":
            link=link.split('/')[-2]
            a=['A', 'B', 'C', 'D', 'E', 'F', 'G', 'I', 'L'      , 'N'   , 'S'   ]
            b=['0', '.', '/', '?', '-', '=', '&', '_', 'http://', '.com', 'www.']
            for i in range(0,len(a)):
                link=link.replace('0'+a[-i],b[-i])
        return link

    feeds          = [(u'Macity', u'http://www.macitynet.it.feedsportal.com/c/33714/f/599513/index.rss')]
    __author__      = 'faber1971'
    description = 'Apple and hi-tech news'

