mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Revista Piaui by Eduardo Simoes
This commit is contained in:
parent
b13a2a08a3
commit
211786644f
29
recipes/revista_piaui.recipe
Normal file
29
recipes/revista_piaui.recipe
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class RevistaPiaui(BasicNewsRecipe):
|
||||||
|
title = u'Revista piau\xed'
|
||||||
|
language = 'pt_BR'
|
||||||
|
__author__ = u'Eduardo Gustini Simões'
|
||||||
|
oldest_article = 31
|
||||||
|
max_articles_per_feed = 50
|
||||||
|
auto_cleanup = True
|
||||||
|
|
||||||
|
feeds = [(u'Edi\xe7\xe3o Atual', u'http://revistapiaui.estadao.com.br/feed/rss/edicao-atual.xml')]
|
||||||
|
|
||||||
|
def parse_feeds (self):
|
||||||
|
feeds = BasicNewsRecipe.parse_feeds(self)
|
||||||
|
for feed in feeds:
|
||||||
|
for article in feed.articles[:]:
|
||||||
|
soup = self.index_to_soup('http://revistapiaui.estadao.com.br/feed/rss/edicao-atual.xml')
|
||||||
|
itemTitle = article.title.partition('|')[0].rstrip()
|
||||||
|
item = soup.find(text=itemTitle)
|
||||||
|
articleDescription = item.parent.parent.description.string.partition('<br />')[2]
|
||||||
|
article.summary = articleDescription
|
||||||
|
|
||||||
|
return feeds
|
||||||
|
|
||||||
|
def populate_article_metadata(self, article, soup, first):
|
||||||
|
h2 = soup.find('h2')
|
||||||
|
h2.string.replaceWith(h2.string.partition('|')[0].rstrip())
|
||||||
|
h2.replaceWith(h2.prettify() + '<p><em>' + article.summary + '</em></p><p><em>' + ' posted at ' + article.localtime.strftime('%d-%m-%Y') + '</em></p>')
|
Loading…
x
Reference in New Issue
Block a user