11-27-2014, 04:23 AM | #1 |
Member
Posts: 17
Karma: 10
Join Date: Nov 2014
Device: Kobo Mini
|
Rewrite title from each article
Hi
How can I do that my recipe change the title of each feed? For example, the original title of the feeds are: http://ganemosmadrid.info/category/a...minismos/feed/ 3er. ACTA REUNION GANEMOS FEMINISMOS MADRID 1er ACTA REUNIÓN-GANEMOS FEMINISMO_MADRID 4ª ACTA REUNION GANEMOS FENIMISMOS MADRID 2o. ACTA REUNIÓN GANEMOS FEMINISMO MADRID And I want to change it for: 3º Acta Ganemos Feminismos 1º Acta Ganemos Feminismos 4º Acta Ganemos Feminismos 2º Acta Ganemos Feminismos So I gues I need a function that get the original title to be able to check it with regular expressions, modification it and return the new title, but I don't find this function. Any help? Thanks |
11-28-2014, 06:29 PM | #2 |
Member
Posts: 17
Karma: 10
Join Date: Nov 2014
Device: Kobo Mini
|
Finally I do it work with:
Code:
def parse_feeds (self): r = re.compile(u'^(\d+)(er\.?|o\.?|a\.|º|ª) (.*ACTA.*FE[MN]I[MN]ISMO.*)$', re.IGNORECASE|re.UNICODE) feeds = BasicNewsRecipe.parse_feeds(self) for f in feeds: for a,c in enumerate(f.articles): c.title=r.sub('\\1ª Acta Ganemos Feminismos',c.title) return feeds |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Preventing Page Title from Being Inserted into Article Text | buffaloseven | Recipes | 0 | 07-25-2013 11:39 PM |
KT -- complete rewrite? | tlc | Kindle Developer's Corner | 2 | 11-30-2011 10:29 AM |
Can't extract article title in parse index | hiperlink | Recipes | 19 | 01-18-2011 11:00 AM |
Article tweak for title sort not working | Manichean | Calibre | 2 | 10-04-2010 11:56 AM |