05-12-2008, 06:42 AM | #1 |
Member
Posts: 24
Karma: 28
Join Date: Mar 2008
Device: Sony Reader
|
Calibre custom news feed and python help.
Hallo!
I've been building a custom news feed for the UK guardian, but I have hit a problem because my knowledge of python is none existent Here's the rub: The rss feed returns an article url in the format of: Code:
http://www.guardian.co.uk/politics/2008/may/12/alistairdarling.taxandspending?gusrc=rss&feed=politics Code:
http://www.guardian.co.uk/politics/2008/may/12/alistairdarling.taxandspending/print From looking at the included feeds I think I need to be using urlparse, but can't figure out how to structure it. My starting point is this from the WSJ recipie, but obviously it won't work in its current form: Code:
def print_version(self, url): article = urlparse.urlparse(url).path.rpartition('/')[-1] return 'http://www.guardian.co.uk/'+article |
05-12-2008, 08:50 AM | #2 |
creator of calibre
Posts: 44,289
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Code:
def print_version(url): return url.partition('?')[0] + '/print' |
Advert | |
|
05-23-2008, 02:26 PM | #3 |
Junior Member
Posts: 7
Karma: 10
Join Date: Apr 2008
Location: British Columbia, Canada
Device: Sony PRS-505
|
thanks
... thanks
Last edited by Ben_B; 05-23-2008 at 02:30 PM. Reason: wrong thread |
05-30-2008, 06:32 AM | #4 |
Member
Posts: 24
Karma: 28
Join Date: Mar 2008
Device: Sony Reader
|
Aye, thanks from me too. I forgot to return and say that it worked.
|
10-08-2009, 09:26 AM | #5 |
Junior Member
Posts: 3
Karma: 10
Join Date: Oct 2009
Device: Kindle 2
|
I'm new to this too and was looking for how to subscribe to the Guardian. Any chance you could share that code and point me in the right direction on how to set it up?
THANKS! |
Advert | |
|
Thread Tools | Search this Thread |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
News Feed Covers | DenverReader | Calibre | 4 | 02-06-2010 12:00 AM |
calibre 0.6.20 won't complete NY Times news feed | Zapped | Calibre | 9 | 11-13-2009 10:41 AM |
Help Creating custom RSS feed need only the image | Malakai | Calibre | 0 | 07-31-2009 04:28 PM |
Missing Text in Custom feed | kitzj0 | Calibre | 3 | 02-16-2009 10:29 PM |
Share your LibPRS Python RSS Feeds and where to obtain more feed links! | GatorDeb | Calibre | 15 | 03-05-2008 06:30 AM |