From bd9c9d8c7ae8249a49ce648bbec8f85c65eba7fb Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 8 May 2012 07:50:02 +0530 Subject: [PATCH] Fix #995952 (New recipe for Folha do sao paulo) --- recipes/folha.recipe | 82 ++++++++++++++++++++++++++++++++++++++++ recipes/icons/folha.png | Bin 0 -> 1640 bytes 2 files changed, 82 insertions(+) create mode 100644 recipes/folha.recipe create mode 100644 recipes/icons/folha.png diff --git a/recipes/folha.recipe b/recipes/folha.recipe new file mode 100644 index 0000000000..bf5dc509a7 --- /dev/null +++ b/recipes/folha.recipe @@ -0,0 +1,82 @@ +# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai + +__license__ = 'GPL v3' +__copyright__ = '2012, Darko Miletic ' +''' +www.folha.uol.com.br +''' +import urllib +from calibre.web.feeds.news import BasicNewsRecipe + +class Folha_de_s_paulo(BasicNewsRecipe): + title = u'Folha de São Paulo - portal' + __author__ = 'Darko Miletic' + description = 'Um Jornala a servicao do Brasil' + publisher = 'Folhapress' + category = 'news, politics, Brasil' + oldest_article = 2 + max_articles_per_feed = 200 + no_stylesheets = True + encoding = 'cp1252' + use_embedded_content = False + language = 'pt_BR' + remove_empty_feeds = True + publication_type = 'newspaper' + masthead_url = 'http://f.i.uol.com.br/fsp/furniture/images/lgo-fsp-430x50-ffffff.gif' + extra_css = """ + body{font-family: Arial,Helvetica,sans-serif } + img{margin-bottom: 0.4em; display:block} + """ + + conversion_options = { + 'comment' : description + , 'tags' : category + , 'publisher' : publisher + , 'language' : language + } + + remove_tags = [dict(name=['meta','link','base','iframe','embed','object'])] + keep_only_tags = [dict(attrs={'id':'articleNew'})] + + + feeds = [ + (u'Poder' , u'http://feeds.folha.uol.com.br/poder/rss091.xml' ) + ,(u'Mundo' , u'http://feeds.folha.uol.com.br/mundo/rss091.xml' ) + ,(u'Mercado' , u'http://feeds.folha.uol.com.br/mercado/rss091.xml' ) + ,(u'Cotidiano' , u'http://feeds.folha.uol.com.br/cotidiano/rss091.xml' ) + ,(u'Esporte' , u'http://feeds.folha.uol.com.br/esporte/rss091.xml' ) + ,(u'Ilustrada' , u'http://feeds.folha.uol.com.br/ilustrada/rss091.xml' ) + ,(u'F5' , u'http://feeds.folha.uol.com.br/f5/rss091.xml' ) + ,(u'Ciência' , u'http://feeds.folha.uol.com.br/ciencia/rss091.xml' ) + ,(u'Tec' , u'http://feeds.folha.uol.com.br/tec/rss091.xml' ) + ,(u'Ambiente' , u'http://feeds.folha.uol.com.br/ambiente/rss091.xml' ) + ,(u'Bichos' , u'http://feeds.folha.uol.com.br/bichos/rss091.xml' ) + ,(u'Celebridades' , u'http://feeds.folha.uol.com.br/celebridades/rss091.xml' ) + ,(u'Comida' , u'http://feeds.folha.uol.com.br/comida/rss091.xml' ) + ,(u'Equilibrio' , u'http://feeds.folha.uol.com.br/equilibrioesaude/rss091.xml' ) + ,(u'Folhateen' , u'http://feeds.folha.uol.com.br/folhateen/rss091.xml' ) + ,(u'Folhinha' , u'http://feeds.folha.uol.com.br/folhinha/rss091.xml' ) + ,(u'Ilustrissima' , u'http://feeds.folha.uol.com.br/ilustrissima/rss091.xml' ) + ,(u'Saber' , u'http://feeds.folha.uol.com.br/saber/rss091.xml' ) + ,(u'Turismo' , u'http://feeds.folha.uol.com.br/turismo/rss091.xml' ) + ,(u'Panel do Leitor', u'http://feeds.folha.uol.com.br/folha/paineldoleitor/rss091.xml') + ,(u'Publifolha' , u'http://feeds.folha.uol.com.br/folha/publifolha/rss091.xml' ) + ,(u'Em cima da hora', u'http://feeds.folha.uol.com.br/emcimadahora/rss091.xml' ) + ] + + def get_article_url(self, article): + url = BasicNewsRecipe.get_article_url(self, article) + curl = url.partition('/*')[2] + return curl + + def print_version(self, url): + return 'http://tools.folha.com.br/print?site=emcimadahora&url=' + urllib.quote_plus(url) + + def get_cover_url(self): + soup = self.index_to_soup('http://www.folha.uol.com.br/') + cont = soup.find('div', attrs={'id':'newspaper'}) + if cont: + ai = cont.find('a', href='http://www1.folha.uol.com.br/fsp/') + if ai: + return ai.img['src'] + return None diff --git a/recipes/icons/folha.png b/recipes/icons/folha.png new file mode 100644 index 0000000000000000000000000000000000000000..dbf2c9222c95124c2ea77936a04419d02c4feeab GIT binary patch literal 1640 zcmV-u2ABDXP)*VEzacap9E9958~zcp>76H0|T?{>+bWBx87li zupwNQz|GlupTrhGa6o5`04!mivc^Pqs3cN-fts|c#o%3ip32qXFk_d)+wxV4zG|Dx z3PE|2vCrS;@ALNh8&irTM|D(wsCJmTYKf;pZJ3(A;$)AyCRvQM%HTnHu?aeBCt{tP zw$K_%dBD-)ilMkwgRucLXrjQ}Pj{a=V2LhgpqH$};_UT_r^PyJoxa!aK5?WHMtT}n zk}6)3fS$bV^!i$ew*Vtrq_@dWg}nwSU2dPz4nJ^Wm(0=I<&dt(NqnzZj>H^LgngH? zT7ju#mBau%cl!JMy2#ZbOnEF^j5KGPRd|}Ez15hq%ual($=~!BMs%#f)*)4hbd$4j zj;cCxsRcZ9Az6@$rN00zXAVMjuEg6)b)i~@uK*`v@ACH6-{`x};TTMRQG~bV>+! zCsv1*ugNxDg)m=_05oi}$K7X|&QE-%V2-_1hq)zOlaQ*!IBcNK*yF?0t{^RNI*5T|1H);qwZwfwfG-Q;1pTIzHpk0u|05D^eslP#Vr)QbVVwK4ZM0>Bm z(s!nyVdR$NP8YicbT=(m9)((Vwi}cyG3-RNO-78ezf=b`T!|pA5@5q zr@%UDnplg!VUD>EMtvk$i#>3nTaLm?eXsyBW+6{~ew(>Ha;E?-WCJZ>A5w*yw9Yqb zolJkS{r&#w?egL1@yFfs12$;}I&BU;Zmhr3DOiXnUY3lcyfA5^gq^p5nX`JBwq};b zMS8AXiM9YGTmUz2w#wcYN`D+ykd>^(HeZKuq0xGw#(S2pN@$m80009cNkl zgXgPO8O-X|W1(GCXsDJQOA0`sVM?vdlF8Exj)MxUt*r}=TMu|=Q(1dD#V`=8APLc^ z^t~DVEz%f45EtVkAGgN4JRN;#jD~M?rACMlfS6|AC-%)@qc*xA$g_>TFWectTOK)g zUGv>1zRfWZc-Gm6>D8UnD;a_y@g?tB7I!9Giku{?(+jh&^8|p(6(?ENh)ea%AutaY z_qwq>e)-BkagAk?I2QsFyhg0VUtfO=K*y4BKWHdaizEhH=zK?;V5yO<9TWY z1XnlVF*AD(?>V!SgX2n04g?Wa9EBpyq+*{OK`t*o$f+3S^Dc zCiwyV2Ox&9SKVcY?ZbbqfEEtDxD?LhHpioV3W;`rKqdRX>vs3?@yj~nwv0lF z_A5~RyRL0&YSQmCaH>1@*9uG#xCl&Tn?aW?6=JQ4=!