Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Recipes

Notices

Reply
 
Thread Tools Search this Thread
Old 07-25-2014, 09:19 AM   #1
steinarb
Enthusiast
steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.
 
Posts: 27
Karma: 53696
Join Date: Nov 2012
Device: Sony PRS T-1
Different keep_only_tags and remove_tags for different feeds

Is it possible to have different keep_only_tags and remove_tags for different feeds?

What is used for short bulletin news articles in two of the feeds (ie. all of the content in the feeds) is used as "see also" teasers in full-size articles in other feeds.

The recipe is here: https://github.com/steinarb/calibre-...ter/nrk.recipe

The element in question, is:
Code:
dict(name='article', attrs={'class':'teaser widget rich js-realtime emphasis-medium bulletin'}),
This element is the actual content of the feeds:
Code:
(u'NRK Østlandssendingen', u'http://www.nrk.no/ostlandssendingen/siste.rss'),
(u'NRK Nordland', u'http://www.nrk.no/nordland/siste.rss'),
But in the other feeds the same element is used for "see also" items (with no surrounding identifying element).
steinarb is offline   Reply With Quote
Old 07-25-2014, 09:37 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,345
Karma: 27182818
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, it isn't. I suggest you implement postprocess_html() to remove the bad see also elements manually in your recipe.
kovidgoyal is online now   Reply With Quote
Advert
Old 07-27-2014, 04:07 PM   #3
steinarb
Enthusiast
steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.steinarb is no e-book dilettante.
 
Posts: 27
Karma: 53696
Join Date: Nov 2012
Device: Sony PRS T-1
Ok, thanks!

Is the feed available in the soup somehow? That would make identification simpler.

If not, one possible ad-hoc rule would be to leave the elements alone if there is only one of them. This would leave the content alone in the feeds/sections where this element is content, and at least cut the clutter in the articles where the element is used as "see also".
steinarb is offline   Reply With Quote
Reply

Tags
different rules per feed, news, recipe


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
getting rid of images: remove_tags has no effect? Read&Write Recipes 2 06-26-2012 01:27 PM
Priority between keep_only_tags and remove_tags BruceBerry Recipes 1 11-19-2011 03:10 PM
remove_tags does not work JFS-NMF Recipes 1 03-04-2011 01:56 PM
keep_only_tags and findAll boocko Recipes 3 11-18-2010 11:59 AM
keep_only_tags ultimatebuster Calibre 4 03-19-2010 07:49 PM


All times are GMT -4. The time now is 08:12 AM.


MobileRead.com is a privately owned, operated and funded community.