Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-13-2011, 11:17 PM   #1
baron
Junior Member
baron began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2011
Device: kindle
improved The Economist recipe

Thanks so much for this wonderful program.

While the Economist is great, I've been bothered by the fact that the titles don't follow the print or web edition in appearance and the fact that "related links" appeared in the middle of the article. Since I didn't see the need for those to interrupt the flow, I've removed those.

Without further ado, here are the changes I've made.

https://gist.github.com/971587
baron is offline   Reply With Quote
Old 06-13-2011, 01:06 AM   #2
warloser2000
Junior Member
warloser2000 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jun 2011
Device: Kindle 3
Hi baron. I was bothered by those "related links" as well. As a kindle user, there isn't a way, to my knowledge, of using them. I've read that other e-readers are able to make use of them. That said, thank very much for your recipe. I tried it, I loved it. It make it much more enjoyable to read the Economist. =)
warloser2000 is offline   Reply With Quote
Advert
Old 06-13-2011, 03:07 PM   #3
kaniff
Junior Member
kaniff began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jun 2011
Device: PRS-600BC
Hi Baron, can you make a .recipe file for this? All I see is a bunch of code and I have no idea what to do with that, thanks.
kaniff is offline   Reply With Quote
Old 06-14-2011, 10:37 AM   #4
Starson17
Wizard
Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.Starson17 can program the VCR without an owner's manual.
 
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
Quote:
Originally Posted by kaniff View Post
Hi Baron, can you make a .recipe file for this? All I see is a bunch of code and I have no idea what to do with that, thanks.
Start at the "Add a custom news source" dialog screen reached by clicking the black triangle to the right of "Fetch News" on Calibre's main icon toolbar.

Switch to the Advanced Mode.

Copy the code you saw and paste it into the panel on the right (replace everything in that panel with the new code).

Click the button marked "Add/Update recipe" to save it.

The recipe is saved under the title of the recipe that appears on the line "title=" found in each recipe.

You can change the title line to change the name of your recipe. If a custom recipe with that name already exists, you will get an overwrite warning. Don't worry about overwriting builtin recipes - you can't and you can have a custom recipe with the same name as a builtin.

Schedule your new custom recipe normally. It's in the custom area (which won't appear until you have at least one custom recipe).
Starson17 is offline   Reply With Quote
Old 07-28-2011, 11:58 PM   #5
dereferenced
Junior Member
dereferenced began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2011
Device: kindle
Bump. I followed the directions. When I try to download, I get the "'Could not find any articles. Has your subscription expired?'" exception.

Does this recipie need to be modified? I have a login, but I noticed the browser w/ login info was commented out. I went to the index URL when logged out in my browser
INDEX = 'http://www.economist.com/printedition'
And noticed I got redirected to
http://www.economist.com/printedition/2011-07-30

Could this be breaking the recipie?
dereferenced is offline   Reply With Quote
Advert
Old 07-29-2011, 12:56 AM   #6
baron
Junior Member
baron began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2011
Device: kindle
that's strange. I've gotten the latest issue. I have my login details filled in on the Calibre side and my subscription's actually expired.

the INDEX thing shouldn't be a problem, it just ensures that the latest edition is processed. You might want to double check the credentials you're using within Calibre. HTH

Last edited by baron; 07-29-2011 at 12:58 AM.
baron is offline   Reply With Quote
Old 07-29-2011, 12:58 AM   #7
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
The economist does not require login to access its articles. The format of the printedition page changed this week. I've already updated the recipe accordingly.
kovidgoyal is online now   Reply With Quote
Old 07-29-2011, 08:01 AM   #8
QueenPepper
Member
QueenPepper began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jun 2011
Device: Kobo Touch
Quote:
Originally Posted by kovidgoyal View Post
The economist does not require login to access its articles. The format of the printedition page changed this week. I've already updated the recipe accordingly.
That's great. Could you share the updated recipe with us, please?
QueenPepper is offline   Reply With Quote
Old 07-29-2011, 08:05 AM   #9
QueenPepper
Member
QueenPepper began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jun 2011
Device: Kobo Touch
Oh, never mind, I see that it's in the latest Calibre update! Thanks!
QueenPepper is offline   Reply With Quote
Old 07-29-2011, 09:26 AM   #10
TOWiz
Junior Member
TOWiz began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2011
Location: Boston
Device: Kindle 3
How to log in?

[Edit: never mind, I posted before reading today's replies. It seems that there's a fixed version of this recipe built into the latest Calibre. I deleted the custom recipe and am now using the built-in one. Seems to work.]

Thanks, baron, I really like the formatting this recipe gets.

I've run into a bit of difficulty, though: after the first two uses, the download now fails with the message "Could not find any articles. Has your subscription expired?" My Economist subscription is current, and I have full access to the site via my browser after logging in.

I've changed the "needs_subscription" value to true in the recipe, but then the failure message says "The 'The Economist' recipe needs a username and password." Reading the doc, I thought that setting needs_subscription to true means Calibre will ask me for my username and password, but that doesn't happen. It just proceeds with running the recipe and failing because it doesn't have the login info.

I've also tried uncommenting the get_browser method in the recipe and hard-coding my username and password strings in there. But that still failed with the same "needs username/password" message.

I'm not really sure how to solve the problem. Does anyone know why Calibre isn't asking me for my username and password?

Many thanks...

Last edited by TOWiz; 07-29-2011 at 09:31 AM. Reason: Failed to read all posts before replying :(
TOWiz is offline   Reply With Quote
Old 07-29-2011, 09:49 AM   #11
technicaltitch
Member
technicaltitch began at the beginning.
 
Posts: 20
Karma: 10
Join Date: Jul 2011
Device: Sony PRS 350
Excuse the noob here, but I can't get either the 0.8.11 version or the baron's version working - I get "Has your subscription expired?" with both since the Economist changed format this week. (Perhaps they have different formats or rules for different countries? I assume an upgrade install will replace the built in recipes with the new versions.)

In case anyone else is getting this issue, and they are as clueless as me with python, soup, etc, I have found that replacing parse_index (and economist_parse_index) with the following works. It is horrendous code and should be deleted asap, and is the stuff of nightmares for Kovid - I've cut every corner I can and barely understand it, but it gets the article text from the new website into my PRS until someone cleverer looks at it.

PHP Code:
    def parse_index(self):
        
articles = []
        
soup self.index_to_soup(self.INDEX)
        
cover None
        feeds 
= []
        for 
section in soup.findAll('div'attrs={'class':'article'}):
            
section_title 'section title'
            
articles = []
            for 
post in section.findAll('a'href=True):
                
url post['href']
                if 
url.startswith('/'):
                  
url 'http://www.economist.com'+url
                  title 
self.tag_to_string(post)
                  
articles.append({'title':title'url':url})
            if 
articles:
                
feeds.append((section_titlearticles))
        return 
feeds 
If this doesn't work for some people, perhaps the Economist needs two recipes.

HUGE thanks for oneillpt for this brilliant post:
https://www.mobileread.com/forums/sho...71&postcount=3

And this thread:
https://www.mobileread.com/forums/arc.../t-121643.html
technicaltitch is offline   Reply With Quote
Old 07-29-2011, 01:43 PM   #12
msmart
Junior Member
msmart began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2011
Device: kindle 3
thanks technicaltitch your quick fix worked for the pages but my table of content not displayed correctly (a lot of empty section titles...)

I have the same error message as you... (germany)
msmart is offline   Reply With Quote
Old 07-29-2011, 05:17 PM   #13
Mlieberman55
Junior Member
Mlieberman55 began at the beginning.
 
Posts: 1
Karma: 10
Join Date: Jul 2011
Device: Kindle
Quote:
Originally Posted by kovidgoyal View Post
The economist does not require login to access its articles. The format of the printedition page changed this week. I've already updated the recipe accordingly.

Thank you for updating The Economist so quickly. FYI, I am still missing the front "Briefing" section.
Mlieberman55 is offline   Reply With Quote
Old 07-29-2011, 05:22 PM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,858
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by Mlieberman55 View Post
Thank you for updating The Economist so quickly. FYI, I am still missing the front "Briefing" section.
That should be included now. Try it again.
kovidgoyal is online now   Reply With Quote
Old 07-29-2011, 05:29 PM   #15
satisficer
Junior Member
satisficer began at the beginning.
 
Posts: 8
Karma: 10
Join Date: Jul 2011
Device: Kindle3
I updated to 0.8.12 and get the following error -- this is from archlinux pkg updated today -- but I received similar message using command-line on ubuntu using today's binary:

Code:
calibre, version 0.8.12
ERROR: Conversion Error: <b>Failed</b>: Fetch news from The Economist (RSS)

Fetch news from The Economist (RSS)
Resolved conversion options
calibre version: 0.8.12

...{OPTIONS HERE}...

InputFormatPlugin: Recipe Input running
Traceback (most recent call last):
  File "/usr/bin/calibre-parallel", line 19, in <module>
    sys.exit(main())
  File "/usr/lib/calibre/calibre/utils/ipc/worker.py", line 181, in main
    result = func(*args, **kwargs)
  File "/usr/lib/calibre/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
    plumber.run()
  File "/usr/lib/calibre/calibre/ebooks/conversion/plumber.py", line 937, in run
    accelerators, tdir)
  File "/usr/lib/calibre/calibre/customize/conversion.py", line 204, in __call__
    log, accelerators)
  File "/usr/lib/calibre/calibre/web/feeds/input.py", line 105, in convert
    ro.download()
  File "/usr/lib/calibre/calibre/web/feeds/news.py", line 737, in download
    res = self.build_index()
  File "/usr/lib/calibre/calibre/web/feeds/news.py", line 874, in build_index
    feeds = feeds_from_index(self.parse_index(), oldest_article=self.oldest_article,
  File "/tmp/calibre_0.8.12_tmp_KXHovR/calibre_0.8.12_BkAxYX_recipes/recipe0.py", line 69, in parse_index
    self.feed_dict.items()])
  File "/tmp/calibre_0.8.12_tmp_KXHovR/calibre_0.8.12_BkAxYX_recipes/recipe0.py", line 73, in eco_sort_sections
    raise ValueError('No new articles found')
ValueError: No new articles found
Is anyone seeing this in the updated version?
satisficer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Improved recipe for hungarian '168 óra' ironcat Recipes 1 03-24-2011 06:53 AM
Economist recipe jdomingos76 Recipes 1 03-08-2011 08:33 AM
Improved recipe for Le Monde veezh Recipes 0 02-25-2011 04:14 AM
Economist Free Recipe geneaber Calibre 10 12-31-2009 03:45 PM
Problems with Economist recipe 0.5.1 MTBSJC Calibre 7 03-23-2009 01:54 PM


All times are GMT -4. The time now is 12:25 PM.


MobileRead.com is a privately owned, operated and funded community.