09-29-2010, 04:13 PM | #1 |
Enthusiast
Posts: 38
Karma: 10
Join Date: Nov 2009
Location: Poland
Device: kindle 1st gen, kindle dxg, kindle paperwhite2
|
how to filter feeds
Hello!
I have some recipes that are almost ready to publish, but there are some articles that won't work on e-readers. I want to filter them out by URL. It should be easy, as their URLs contains some unique strings. Here is my try, that depicts the idea, but doesn't work at all: Code:
def get_article_url(self, article): link = article.get('link') audio = link.find('audio') if not audio: return link |
09-29-2010, 04:18 PM | #2 | |
Addict
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
Quote:
Spoiler:
Last edited by TonytheBookworm; 09-29-2010 at 04:20 PM. |
|
Advert | |
|
09-29-2010, 04:20 PM | #3 |
creator of calibre
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You want
Code:
def get_article_url(self, article): link = article.get('link') if 'audio' not in link: return link |
09-29-2010, 04:39 PM | #4 | |
Enthusiast
Posts: 38
Karma: 10
Join Date: Nov 2009
Location: Poland
Device: kindle 1st gen, kindle dxg, kindle paperwhite2
|
Quote:
http://github.com/t3d/kalibrator/com...3ad755eb6e597e Thanks! |
|
09-29-2010, 04:56 PM | #5 | |
Addict
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
Quote:
Thanks for showing that method. I have been doing the preprocess one for a while like with the popscience.recipe but your method is cleaner and faster. Thanks again. I will be updating the popscience for submission in a future build so it implements this. That is one thing I love about this forum and calibre. I learn something new every single day by folks helping others. |
|
Advert | |
|
09-29-2010, 05:02 PM | #6 |
creator of calibre
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
@TtB: That emthod is for recipes that download articles from RSS feeds. It filters items from the RSS feed. It is not meant for filtering links in the actual article
|
09-29-2010, 05:15 PM | #7 |
Addict
Posts: 264
Karma: 62
Join Date: May 2010
Device: kindle 2, kindle 3, Kindle fire
|
|
10-03-2010, 09:29 AM | #8 |
Enthusiast
Posts: 38
Karma: 10
Join Date: Nov 2009
Location: Poland
Device: kindle 1st gen, kindle dxg, kindle paperwhite2
|
@Kovid
I didn't expect you would immediately add my recipe Actually I recently improved the string used for filtering so that eg. article with 'audiobook' in title wouldn't be ommited Could you please update it with this revision: http://github.com/t3d/kalibrator/raw..._opinie.recipe It is the same source as rmf24_fakty.recipe and rmf24_ESKN.recipe, so please link it to the same favicon. I sometimes split one source into more recipes to prevent ebook files from growing into files too big for ebook devices, and separate not related topics. |
10-03-2010, 12:45 PM | #9 |
creator of calibre
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
done .
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
My Smashwords ebook filter | Richard Herley | Reading Recommendations | 10 | 11-28-2010 09:42 AM |
TOC Filter Help???? | erics1019 | Calibre | 1 | 06-10-2010 01:53 PM |
Filter question | edbro | Calibre | 2 | 01-20-2010 08:44 PM |