![]() |
#1 |
Enthusiast
![]() Posts: 41
Karma: 10
Join Date: May 2011
Location: Colombia
Device: Kindle
|
Adding/substracting string to a feed
Hello,
As is suggested in the Calibre manual (BBC news), I am trying with the column of Andrés Oppenheimer in Miami Herald, I want o use the pintable version because the normal one is split in two screens, while pintable version NOT so. My problem is that I don’t find a way to insert a string at n character let me show The original feed is: http://www.elnuevoherald.com/2012/02/18/1130892/andres-oppenheimer-nuevos-vientos.html#storylink=rss and the pintable version is: http://www.elnuevoherald.com/2012/02/18/v-print/1130892/andres-oppenheimer-nuevos-vientos.html So the difference is that Printable version has “v-print/” at the 30 character of the original feed and substract "#storylink=rss" This is my first attempt to build a recipe, I don find a instruction to insert “v-print/” at the 30 character, and substract "#storylink=rss" at the end. I thanks any help |
![]() |
![]() |
![]() |
#2 |
Junior Member
![]() Posts: 5
Karma: 10
Join Date: Feb 2012
Device: Sony PRS-350
|
I'm new to Python, so there may be a better way to do this. However, this is how I would do it:
Code:
parts = re.match(r"(?P<begin>http://www.elnuevoherald.com/\d+/\d+/\d+)(?P<end>/\d+/.+\.html)", feed) feed = parts.group('begin') + "/v-print" + parts.group('end') |
![]() |
![]() |
Advert | |
|
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Mathch a string while ignoring some character in that string? | ElMiko | Sigil | 12 | 12-01-2011 10:05 PM |
String freeze preparing for 0.5 | user_none | Sigil | 10 | 11-12-2011 03:49 PM |
adding contents to the recipe feed | poldem | Recipes | 4 | 03-26-2011 05:10 PM |
Adding a feed to a collection | Lev667 | Amazon Kindle | 2 | 03-05-2011 09:14 PM |
Adding a feed to the built-in NY Times recipe | t0s | Recipes | 3 | 03-03-2011 11:26 AM |