04-01-2011, 07:35 AM | #1 |
Junior Member
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
|
Recipe for ng.pl
Hi all,
I'm complete newbie user of calibre and has zero experience with programming. I was trying to make my first custom recipe for a print version of national-geographic.pl articles. I compared urls both non print and print version, and for me seems that I need to replace 'artykuly/pokaz' with 'drukuj-artykul'. Examples: http://www.national-geographic.pl/ar...ojny-z-zaraza/ http://www.national-geographic.pl/dr...ojny-z-zaraza/ I created the part after "def print_version" according to instruction I found - but it does not work - fetching basic, non print version of an article. Can anyone help me please? class al(BasicNewsRecipe): author = 'mk' description = 'National Geographic' title = u'National Geographic' oldest_article = 7 max_articles_per_feed = 5 feeds = [(u'National Geographic', u'http://www.national-geographic.pl/rss/')] def print_version(self, url): return url.replace('artykuly/pokaz', 'drukuj-artykul') |
04-06-2011, 04:46 AM | #2 |
Connoisseur
Posts: 63
Karma: 10
Join Date: Dec 2010
Device: kindle
|
I assume your recipe has the correct indentation, what you've written would not run in Python. The feed links have a '0C' instead of '/', so your function must be
Code:
def print_version(self, url): return url.replace('artykuly0Cpokaz', 'drukuj-artykul') |
Advert | |
|
04-08-2011, 03:56 AM | #3 | |
Junior Member
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
|
Quote:
Marcin |
|
04-12-2011, 08:56 AM | #4 |
Junior Member
Posts: 6
Karma: 10
Join Date: Dec 2010
Device: none
|
|
04-13-2011, 06:03 PM | #5 |
Connoisseur
Posts: 63
Karma: 10
Join Date: Dec 2010
Device: kindle
|
If you mean the encoding in this source, this is not the standard char to hex conversion, that would be 0x2f for '/', so you have to look e.g. in the trace output of ebook-convert to see what urls are involved.
|
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Recipe works when mocked up as Python file, fails when converted to Recipe | ode | Recipes | 7 | 09-04-2011 05:57 AM |
new recipe | marbs | Recipes | 0 | 11-24-2010 05:59 AM |
I need some help with a recipe | jefferson_frantz | Recipes | 14 | 11-22-2010 03:06 PM |
New recipe | kiklop74 | Recipes | 0 | 10-05-2010 05:41 PM |
New recipe | kiklop74 | Recipes | 0 | 10-01-2010 03:42 PM |