Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes


Thread Tools Search this Thread
Old 07-14-2011, 11:31 PM   #1
Bortolotto began at the beginning.
Bortolotto's Avatar
Posts: 15
Karma: 14
Join Date: Jun 2011
Location: Brazil
Device: Kindle
Post Recipe for "Revista Piaui" (a brazilian magazine)

Hi buddies!

Today I am posting a recipe to a brazilian magazine named "Revista Piaui". This is a first version. There are some problems not handled yet:
1 - The sort order of articles are based in the date of publication at the feed, not in the magazine's "table of contents".
2 - There are some articles that need a subscriber code. Without that code, there are only a introduction for articles.
3 - There are some links in the feed with content "only on the site". That could be someway removed.
4 - The first article shows, in fact, the list of magazine's contents. But it could be usefull because it has also the cover.

class RevistaPiaui(BasicNewsRecipe):
    title                  = 'Revista Piaui'
    __author__             = 'Diniz Bortolotto'
    description            = 'Revista Piaui'
    publisher              = 'Editora Abril'
    oldest_article         = 30
    max_articles_per_feed  = 30
    category               = 'literacy, magazine'
    language               = 'pt_BR'
    publication_type       = 'magazine'
    use_embedded_content   = False
    no_stylesheets         = True
    remove_javascript      = True

    feeds                  = [('Revista Piaui', '')]

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

    remove_tags            = [
                              dict(name='div', attrs={'class':'compartilhar'}),
                              dict(name='div', attrs={'class':'size'}),
                              dict(name='div', attrs={'class':'divulgar'}),
                              dict(name='div', attrs={'class':'anuncios'}),
                              dict(name='div', attrs={'class':'bloco-conteudo-extra off'})

    reverse_article_order  = True
Attached Files
File Type: txt RevistaPiaui.txt (1.2 KB, 112 views)
File Type: epub RevistaPiaui.epub (1.61 MB, 131 views)
Bortolotto is offline   Reply With Quote
Old 07-15-2011, 07:27 AM   #2
fluzao began at the beginning.
Posts: 15
Karma: 10
Join Date: Apr 2011
Device: Kindle
Muito Obrigado, Bortolotto!

That suits my needs, but also provides me a good starting point to learn how to manipulate recipes. I will try to improve it and post here.

fluzao is offline   Reply With Quote
Old 07-15-2011, 11:12 AM   #3
fluzao began at the beginning.
Posts: 15
Karma: 10
Join Date: Apr 2011
Device: Kindle
Couple of quick comments:

1. I've added

masthead_url           = ''
So that it adds Piaui logo to the top of the articles (I think this is only useful for Kindle users).

2. Also, I've turned off the "reverse_article_order". There is a trade off here. If you revert the order, the first article shows you the cover and the index, which is nice... But if you keep the order as it is, all the subscription-only articles go to the end, keeping the free ones at the top, which is even more useful.

I am trying to figure out a way of:

(a) Change the order so that the last article becomes the first, but the rest of the order is inaltered ([1, 2, 3, ..., n-1, n] to become [n, 1, 2, 3, ..., n-1]).

(b) Get the cover. This is a bit of a challenge for me. The cover is exactly on link n, as I mentioned above. I have to:
I. find link n;
II. look for <div class="img_article">;
III. The cover will be in a location like the one below:

<div class="img_article">
 <img src="/assets/media/images/artigos/1373/AH1309873890x5711.jpg" width="660" alt="" />
fluzao is offline   Reply With Quote
Old 07-16-2011, 02:43 PM   #4
mtsp began at the beginning.
Posts: 31
Karma: 12
Join Date: Jul 2011
Location: São Paulo, Brasil/Brazil
Device: Kindle 3 3G
Thank you both for the work
mtsp is offline   Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Request: recipe for google new "Think Quarterly" magazine gloomygod Recipes 0 03-24-2011 08:08 AM
New Recipe for Revista El Cultural(Spain) jefferson_frantz Recipes 0 10-08-2010 10:18 PM
Article on Plastic Logic in german magazine "Der Spiegel" Manichean News 1 09-18-2008 06:48 AM

All times are GMT -4. The time now is 08:18 AM. is a privately owned, operated and funded community.