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

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-16-2011, 06:33 AM   #1
sexymax15
Enthusiast
sexymax15 began at the beginning.
 
sexymax15's Avatar
 
Posts: 30
Karma: 12
Join Date: Jun 2011
Location: India
Device: Kindle 3g
The Hindu Recipe(Better than the default provided with calibre)

The Hindu recipe(thehindu.com).
Attached Files
File Type: zip The Hindu_1109.zip (466 Bytes, 125 views)
sexymax15 is offline   Reply With Quote
Old 06-16-2011, 11:21 AM   #2
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: 25,248
Karma: 4961457
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
What's the difference to the builtin recipe?
kovidgoyal is online now   Reply With Quote
Old 06-16-2011, 09:56 PM   #3
sexymax15
Enthusiast
sexymax15 began at the beginning.
 
sexymax15's Avatar
 
Posts: 30
Karma: 12
Join Date: Jun 2011
Location: India
Device: Kindle 3g
Quote:
Originally Posted by kovidgoyal View Post
What's the difference to the builtin recipe?
This is the built in version. Here you are not using RSS


Quote:
from __future__ import with_statement
__license__ = 'GPL 3'
__copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'

import time
from calibre.web.feeds.news import BasicNewsRecipe

class TheHindu(BasicNewsRecipe):
title = u'The Hindu'
language = 'en_IN'

oldest_article = 7
__author__ = 'Kovid Goyal'
max_articles_per_feed = 100
no_stylesheets = True

keep_only_tags = [dict(id='content')]
remove_tags = [dict(attrs={'class':['article-links', 'breadcr']}),
dict(id=['email-section', 'right-column', 'printfooter'])]

extra_css = '.photo-caption { font-size: smaller }'

def postprocess_html(self, soup, first_fetch):
for t in soup.findAll(['table', 'tr', 'td','center']):
t.name = 'div'
return soup

def parse_index(self):
today = time.strftime('%Y-%m-%d')
soup = self.index_to_soup(
'http://www.thehindu.com/todays-paper/tp-index/?date=' + today)
div = soup.find(id='left-column')
feeds = []
current_section = None
current_articles = []
for x in div.findAll(['h3', 'div']):
if current_section and x.get('class', '') == 'tpaper':
a = x.find('a', href=True)
if a is not None:
current_articles.append({'url':a['href']+'?css=print',
'title':self.tag_to_string(a), 'date': '',
'description':''})
if x.name == 'h3':
if current_section and current_articles:
feeds.append((current_section, current_articles))
current_section = self.tag_to_string(x)
current_articles = []
return feeds
And this version is mine:


Quote:
class AdvancedUserRecipe1301060393(BasicNewsRecipe):
title = u'The Hindu1'
oldest_article = 7
max_articles_per_feed = 15

feeds = [(u'National', u'http://www.thehindu.com/news/national/?service=feeder'),
(u'International', u'http://www.thehindu.com/news/international/?service=feeder'),
(u'Sports', u'http://www.thehindu.com/sport/?service=feeder'),
(u'States', u'http://www.thehindu.com/news/states/?service=feeder'),
(u'Science', u'http://www.thehindu.com/sci-tech/science/?service=feeder'),
(u'Business', u'http://www.thehindu.com/business/?service=feeder'),
(u'Life&Style', u'http://www.thehindu.com/life-and-style/?service=feeder'),
(u'Arts', u'http://www.thehindu.com/arts/?service=feeder'),
(u'Health',u'http://www.thehindu.com/health/?service=feeder'),
(u'Editorial', u'http://www.thehindu.com/opinion/editorial/?service=feeder'),
(u'Agriculture', u'http://www.thehindu.com/sci-tech/agriculture/?service=feeder')
]
The hindu provides comple RSS feed. So you don't need to make any extra effort just add the RSS feed and your recipe will be ready in no minute.It already provides you the print version of the article.So please up date your calibre 'The Hindu' recipe. Your recipe sometimes doesnot fetch any article.

Comparision:
Calibre Built-In:





New Recipe:






:t hanks:
FOR MAKING CALIBRE


BY THE WAY IF YOU ARE AN INDIAN PLEASE JANLOKPAL AND ANNAHAZARE
sexymax15 is offline   Reply With Quote
Old 06-22-2011, 07:23 AM   #4
valaraukar
Junior Member
valaraukar began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2011
Device: Kindle 3
Hello.

I have to agree with the poster... this recipe does score over the inbuilt one on some points (No offence, Kovid!

I've been reading the Hindu via the inbuilt recipe for a couple of months now, on the Kindle, and to honest, it's not easy to navigate. The default of 100 articles is too much, and at least on the Kindle, navigation between sections is a pain. Jump to the 'Sections and Articles', and there's no way to get back to where you were. Also, I doubt anybody needs a hundred articles on EACH of the major states covered by the Hindu. In addition, the articles in the State sections rarely mention what city or town they're covering, which is rather frustrating. Agreed, this is hardly the fault of the recipe, though.

The RSS feed based system has the advantage of choosing which sections are important to you, and the RSS only covers the new articles. For example, I can add the Hyderabad feed, and not have to wade through the entire AP section.

One problem that's immediately apparent with the new recipe (at least on the Kindle), is that the associated image with the article always appears at the end of the article text, unlike in the beginning of the article, in the inbuilt recipe. Also, the images are stripped of their legends, so no explanation follows the images.

How can this possibly be resolved?
valaraukar is offline   Reply With Quote
Old 06-22-2011, 01:28 PM   #5
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: 25,248
Karma: 4961457
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No worries, I'm not offended, I just asked because I wanted to decide if I should replace the builtin recipe or not. Sounds like it isn't quite a replacement. It's major feature appears to be being able to customize the downloaded content, which would mean it doesn't make sense as a builtin recipe anyway.
kovidgoyal is online now   Reply With Quote
Old 06-23-2011, 01:41 AM   #6
valaraukar
Junior Member
valaraukar began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Jun 2011
Device: Kindle 3
Fair enough.

Any pointers on how to tweak the inbuilt recipe to allow some level of customization? The RSS feed recipe was easy enough to do... but the inbuilt recipe offered no obvious level of manipulation to a noob like me. I do like how the inbuilt recipe maintains the images at the beginning of the post, but the RSS feed method allows me to choose a city specific section.
valaraukar is offline   Reply With Quote
Old 06-23-2011, 02:05 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: 25,248
Karma: 4961457
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
In parse_index() test current_section and skip the values you dont want.
kovidgoyal is online now   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre default folder problem jukin Calibre 3 12-20-2010 07:49 PM
Is a Kobo epub different to the calibre default? bigpallooka Calibre 2 10-25-2010 01:43 PM
eBook, eMagazine provided by different provider kentchan General Discussions 2 08-19-2010 01:13 AM
Default Path Calibre Themus Calibre 2 08-12-2010 10:44 PM
Sony: not publisher-provided ePubs? ATimson ePub 0 06-22-2010 01:21 PM


All times are GMT -4. The time now is 05:41 AM.


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