|
|
#1 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2011
Device: Kindle 3
|
Calibre rss recipe -- <em> tag in article titles?
This is my first time posting and I'm fairly new to writing recipes. I'm having a problem with a recipe that I'm using to download an rss feed to my Kindle3.
The recipe itself works fine except that the article titles sometimes contain <em> and </em> tags (for example, the article title on the Kindle and Calibre v. 0.7.48 will show "<em>Godzilla</em> vs. Real Life"). This was also occurring in the main title once you opened the article but I was able to remove that via "preprocess_html". Since the "preprocess_html" did not affect the article title, can someone provide me some direction as to how to remove the <em> and </em> tags from the article title? I've included the recipe that I'm using below. Thanks! recipe: Code:
import re
from calibre.web.feeds.recipes import BasicNewsRecipe
class AdvancedUserRecipe1288623850(BasicNewsRecipe):
title = u'Hit and Run Blog'
oldest_article = 1
max_articles_per_feed = 100
timefmt = ''
encoding= 'cp1252'
preprocess_regexps = [
(re.compile(r"<em>"),lambda match: ''),
(re.compile(r"</em>"),lambda match: '')
]
feeds = [(u'Hit and Run Blog',
'http://feeds.feedburner.com/reason/HitandRun')]
Moderator Notice
Code tags added. Last edited by Starson17; 03-11-2011 at 02:04 PM. |
|
|
|
|
|
#2 | ||
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,004
Karma: 177841
Join Date: Dec 2009
Device: WinMo: IPAQ; Android: HTC HD2, Archos 7o; Java:Gravity T
|
Quote:
Code:
def populate_article_metadata(self, article, soup, first):
print "Pop article title is: ", article.title
article.title = article.title
return
Quote:
Last edited by Starson17; 03-11-2011 at 02:14 PM. |
||
|
|
|
| Advert | |
|
|
|
|
#3 |
|
Junior Member
![]() Posts: 2
Karma: 10
Join Date: Mar 2011
Device: Kindle 3
|
Thanks for the help! I have it working now.
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| RSS article - page 1 of N | MarcinJunger | Recipes | 0 | 03-06-2011 04:50 PM |
| Recipe for a RSS with a Hodgepodge of Sources? | spedinfargo | Recipes | 1 | 03-01-2011 09:28 AM |
| Changing article titles in recipes | tbaac | Recipes | 8 | 12-22-2010 12:03 PM |
| Help with Recipe inserting tag | TonytheBookworm | Recipes | 1 | 09-25-2010 11:05 AM |
| Downloading and Converting Print version of RSS article | Daanish87 | Calibre | 1 | 06-11-2010 02:08 AM |