![]() |
#2371 |
Connoisseur
![]() Posts: 51
Karma: 10
Join Date: Jul 2010
Device: colognesbook
|
I tried importing the string module using import string but it still didn't work.
I don't know what you mean by did it give an error. I haven't seen any errors throughout any of this. Do you mean launching calibre from the cmd line with a verbose setting? Or is there a built in error messaging that I'm not seeing? Same with the printing, you say you like to " print the results when the recipe runs, then I can see if it's doing what I expect." So you simply insert print statements on the variables? I'll try that. But it runs further without the string there and using as you suggested. However, now I have just the table of contents of rss feed but each link simply leads to: "This article was downloaded by calibre from http://www.metronews.ca/toronto/local/article/589013--caribana-brings-the-summer-spirit-to-toronto" Well that's one specific example, but you see what I mean. I tried inserting a print statement. I simply added print s prior to the return, but I don't see where I'm supposed to see the output. |
![]() |
![]() |
#2372 | |||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Read This. Quote:
Code:
ebook-convert myrecipe.recipe output_dir --test -vv>myrecipe.txt Quote:
Try posting your recipe (Inside code and spoiler tags) - I'll look at it. |
|||
![]() |
Advert | |
|
![]() |
#2373 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Aug 2010
Device: Kobo
|
Assistance requested, please.
Hello all,
I am certainly enjoying the control that calibre gives me with sorting my books with my new Kobo and have decided to try the customization for newsites and the like. As you might guess, I do not understand Python. I have started a recipe and so far have gotten: class AdvancedUserRecipe1280684448(BasicNewsRecipe): title = u'Twisting the Hellmouth' oldest_article = 7 max_articles_per_feed = 100 feeds = [(u'Latest', u'http://www.tthfanfic.org/rss.php')] by following the instructions. This is the RSS feed for the latest stories. Here I have hit a snag, however. I get the first page of all the articles, but nothing beyond that. The suggestion is to use the print url command, which makes sense. The articles do have a print address but it is quite different from the original story address. Story address: http://www.tthfanfic.org/Story-22821...ly+Literal.htm Print address: http://www.tthfanfic.org/wholestory....1&format=print I can see that each article has a special ID identifyer, but I cannot figure out how to extract it and put it into the print url command. I can put the bit after the ID number, but don't know how to fix the front text or even get the ID number. I have tried def print_version(self, url): return url + '&format=print' without success. I have also tried def print_version(self, url): return 'http://www.tthfanfic.org/wholestory.php?no=' + artid + '&format=print' also with out success. I must be missing some vital step. Can someone here assist me? Thank you. |
![]() |
![]() |
#2374 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Notice Code tags and Spoiler tags.
Quote:
Try this: Code:
def print_version(self, url): split1 = url.split("/") xxx = split1[3] split2 = xxx.split("-") artid = split2[1] print "artid is: ', artid return 'http://www.tthfanfic.org/wholestory.php?no=' + artid + '&format=print' Last edited by Starson17; 08-01-2010 at 02:55 PM. |
|
![]() |
![]() |
#2375 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Aug 2010
Device: Kobo
|
Thank you!
Quote:
Here is my adjusted code: Spoiler:
I get the error message "ERROR: Invalid input: Could not create recipe. Error: unindent does not match any outer indentation level (recipe8.py, line 11)" when trying to update it. Am I missing some sort of closing tag? Also, what are the "numbers/subscripts" you mention? Are they the "/" marks in the URL? Thank you |
|
![]() |
Advert | |
|
![]() |
#2376 |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
Has anyone else noticed that the Honolulu Star Advertiser recipe produces double articles -- ie: articles are headed properly but contain the same text repeated twice?
|
![]() |
![]() |
#2377 | ||||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
You're welcome.
Quote:
![]() Quote:
Quote:
Try this: Spoiler:
Quote:
|
||||
![]() |
![]() |
#2378 | |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Aug 2010
Device: Kobo
|
Thank you!
![]() Quote:
|
|
![]() |
![]() |
#2379 | |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
remove_tags = [dict(name='div', attrs={'class':['classname']}),] or whatever into your recipe. |
|
![]() |
![]() |
#2380 | |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Jul 2010
Device: sony
|
Quote:
|
|
![]() |
![]() |
#2381 |
Connoisseur
![]() Posts: 51
Karma: 10
Join Date: Jul 2010
Device: colognesbook
|
@Starson17
Thanks, if you can look at it, it would be appreciated. But the strange thing is I just re-ran it since Friday, and now on some I get the article with no image (haven't verified on the site if those actually have an image), some with just an image, and some with just the header alone. Code:
class AdvancedUserRecipe1280289069(BasicNewsRecipe): title = u'Metro Daily' oldest_article = 7 max_articles_per_feed = 100 feeds = [(u'metro local', u'http://www.metronews.ca/Toronto/local/rss')] def print_version(self, url): baseurl='http://www.metronews.ca/ArticlePrint/' split1 = url.split("/") xxx=split1 [6] split2= xxx[0:5] s = baseurl + split2 print s return s Here are more feeds if it helps in having more examples when generated: Code:
feeds = [ (u'Local', u'http://www.metronews.ca/Toronto/local/rss'), (u'Entertainment', u'http://www.metronews.ca/Toronto/entertainment/rss'), (u'World', u'http://www.metronews.ca/Toronto/world/rss'), (u'Canada',u'http://www.metronews.ca/Toronto/canada/rss'), (u'Business',u'http://www.metronews.ca/Toronto/business/rss') ] |
![]() |
![]() |
#2382 |
Junior Member
![]() Posts: 2
Karma: 22
Join Date: Aug 2010
Location: Brazil
Device: Sony PRS-300, Mobipocket Reader (BB edition)
|
![]()
Hi everyone,
Here goes my first try to write a recipe for Calibre. If anyone wanna give it a try and send me some feedback I will appreciate it very much. Regards, Saverio. |
![]() |
![]() |
#2383 | |
Junior Member
![]() Posts: 2
Karma: 22
Join Date: Aug 2010
Location: Brazil
Device: Sony PRS-300, Mobipocket Reader (BB edition)
|
![]() Quote:
Regards, Saverio. |
|
![]() |
![]() |
#2384 |
Not who you think I am...
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 374
Karma: 30283
Join Date: Jan 2010
Location: Honolulu
Device: PocketBook 360 -- Ivory
|
Thanks Saverio!
|
![]() |
![]() |
#2385 | ||
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Quote:
|
||
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Custom column read ? | pchrist7 | Calibre | 2 | 10-04-2010 02:52 AM |
Archive for custom screensavers | sleeplessdave | Amazon Kindle | 1 | 07-07-2010 12:33 PM |
How to back up preferences and custom recipes? | greenapple | Calibre | 3 | 03-29-2010 05:08 AM |
Donations for Custom Recipes | ddavtian | Calibre | 5 | 01-23-2010 04:54 PM |
Help understanding custom recipes | andersent | Calibre | 0 | 12-17-2009 02:37 PM |