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 11-19-2013, 04:30 PM   #1
tashk
Hello, I'd like to know w
tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.tashk juggles neatly with hedgehogs.
 
Posts: 22
Karma: 69062
Join Date: Mar 2012
Device: Kindle 4 NT, Paperwhite 2013
Question Can remove_tags search for div/style value?

Feed: http://feeds.feedburner.com/infosecResources
Sample article: http://resources.infosecinstitute.co...c+Resources%29

I want to remove the "Want to learn more??" boxes from the article. Here's the relevant part of the HTML source code:

Code:
<div style="margin:20px 0 25px 0;padding-left:25px;padding-right:25px;background-color:#CEECF5;font-size: medium; border:1px solid">
<strong>Want to learn more?? </strong> The InfoSec [...]
and here's my recipe:

Code:
class AdvancedUserRecipe1384894173(BasicNewsRecipe):
    title          = u'test'
    oldest_article = 15
    max_articles_per_feed = 100
    auto_cleanup = True

    feeds          = [(u'InfoSec Institute Resources', u'http://feeds.feedburner.com/infosecResources')]
    remove_tags = [dict(name='div', attrs={'style':'margin:20px 0 25px 0;padding-left:25px;padding-right:25px;background-color:#CEECF5;font-size: medium; border:1px solid'})]
For some reason this does not work as expected; the "Want to learn more??" text is not removed. Am I doing something wrong?
tashk is offline   Reply With Quote
Old 11-19-2013, 10:34 PM   #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: 43,962
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Sure it can, see http://www.crummy.com/software/Beaut...mentation.html for details.

However, if you are trying to remove particular text, I suggest you search for that text and then remove its parent tag. You can do that by implementing preprocess_html in your recipe.
kovidgoyal is offline   Reply With Quote
Advert
Reply


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
Help Please: remove_tags doesn't work in WSJ Chinese Jmot Recipes 5 02-21-2011 04:10 AM
Mobi TOC style vs ePub style? phearlez Kindle Formats 3 04-11-2010 06:35 AM


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


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