02-06-2013, 04:39 AM | #1 |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Full-article blog, fetch, table of contents
I'm trying to fetch a full-article blog RSS.
In my recipe, the value use_embedded_content was set to True. Since each item of the blog feeds is a very long article, the page of table of contents in the resulting ePub turn out be very long! I wonder whether I can shorten the stuff shown in the TOC page, or simply retain only the title of each feed in the TOC page. It seems that the Calibre API does not allow this modifcation. Did anybody tried to solve this? Thanks for sharing your solution! |
02-06-2013, 06:34 AM | #2 |
creator of calibre
Posts: 44,336
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I dont understand the issue. Are you saying there are too many entries in the table of contents. Since each entry corresponds to an article, that would imply for entire epub is too long as well.
|
02-06-2013, 09:12 AM | #3 | |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Quote:
Pls let me give you a example. The first pic, the problematic one, shows a redundant TOC page of an ePub fetched from full-article RSS feed with built-in functionality. My question is, whether it's possible to control/remove the introductory contents under each article title from the TOC page. The second pic shows a very concise TOC page of an ePub fetched from full-article RSS feed with customized parse_index() recipe. Thanks! |
|
02-06-2013, 01:13 PM | #4 |
creator of calibre
Posts: 44,336
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Sure you can control pretty much everything in a recipe by simply overriding the base class functionality. In your case you will want to override the parse_feesdd function to remove the description from the feeds.
|
02-06-2013, 01:40 PM | #5 | |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Quote:
But it seems to be much more difficult than understand parse_index. Could you kindly provide some clues on how to remove the description? Thanks! |
|
02-06-2013, 02:21 PM | #6 |
creator of calibre
Posts: 44,336
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Call the base class parse_feeds, iterate over the returned value setting the description to an empty string for each entry.
|
02-06-2013, 02:58 PM | #7 | |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Quote:
def parse_feeds(self): feeds = BasicNewsRecipe.parse_feeds(self) for currFeed in feeds: for a,currArticle in enumerate(currFeed.articles): currArticle.summary = '' return feeds Thank you! |
|
02-06-2013, 03:10 PM | #8 | |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Quote:
currArticle.summary = '' would delete all the article content. currArticle.text_summary is OK for the job. Thanks! Last edited by surf; 02-06-2013 at 03:12 PM. |
|
02-06-2013, 04:43 PM | #9 | |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Quote:
Could you advise how to change the time format showing in the left picture above? I cann't figure out how to handle the following properties of the Article object formatted_date date Thanks! |
|
02-06-2013, 05:32 PM | #10 |
Member
Posts: 22
Karma: 10
Join Date: Feb 2013
Device: kindle
|
Already done with following code
Code:
from calibre import strftime def parse_feeds(self): feeds = BasicNewsRecipe.parse_feeds(self) for currFeed in feeds: for a,currArticle in enumerate(currFeed.articles): currArticle.text_summary = '' currArticle.formatted_date = strftime('[%Y.%m.%d]',currArticle.date) return feeds |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Fetch all news from a blog | joseprl89 | Recipes | 4 | 01-15-2013 07:13 AM |
Table of Contents not being identified as Table of Contents | openletter | Conversion | 2 | 10-19-2012 12:54 AM |
Could not fetch article. | Steven630 | Recipes | 4 | 05-05-2012 05:00 AM |
calibre fetch news to epub for sony,no table of contents | ich461 | Calibre | 6 | 06-12-2011 12:00 PM |
Decorate article headings as hyperlinks to full article? | tomsem | Recipes | 5 | 10-15-2010 08:30 PM |