01-17-2011, 01:46 PM | #1 |
Member
Posts: 22
Karma: 10
Join Date: Jan 2011
Device: Kindle DX
|
FIX: New York Times Recipe
I've updated the New York Times recipe to resolve the issue from my previous post of occasionally missing articles. The problem was in the postprocess_html function, when a minor formatting problem causes the whole article to not be included. I've included the updated procedure, recipe, and explanation below (this may be happening in other recipes as well).
The caption of one of the photos has a paragraph within a paragraph: <p class="caption"><p><em>“There’s no doubt in my mind that the whole trial will be about did he know right from wrong.”</em><strong> CLARENCE DUPNIK</strong> Pima County sheriff</p> </p> The postprocess procedure thinks there are two paragraphs, and the second paragraph is empty. Thus, the variable caption.contents[0] throws an index out of range error. for caption in soup.findAll(True, {'class':'caption'}) : if caption and caption.contents[0]: The first fix was just to change caption.contents[0] to len(caption) > 0. The second fix is that I added TRY / EXCEPT blocks to every minor change this procedure makes so that in the event there are small inconsistencies that would cause an article to not be included, the errors are logged but the article is still included. Last edited by bcollier; 01-17-2011 at 01:52 PM. |
08-25-2011, 10:57 AM | #2 |
sasa925
Posts: 1
Karma: 10
Join Date: Aug 2011
Location: Israel
Device: kindle 2G
|
could you please explain briefly how to use this link?
|
Advert | |
|
08-25-2011, 11:31 AM | #3 |
Wizard
Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Download the zip file, extract the recipe, read the sticky post above for information on how to use a recipe file obtained here.
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Updated New York Times recipe | nickredding | Recipes | 2 | 11-20-2010 10:53 AM |
New York Times recipe broken? | gianfri | Calibre | 1 | 03-20-2010 09:52 AM |
New York Times recipe | madrone26 | Calibre | 4 | 04-02-2009 01:13 PM |
New York Times on 505 | Hamza | Sony Reader | 21 | 03-03-2008 12:55 PM |
iLiad New York Times | King Mook Mook | iRex | 0 | 12-30-2007 03:22 PM |