Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-17-2011, 11:46 AM   #1
xXxXxXxXxXx
Enthusiast
xXxXxXxXxXx began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Apr 2011
Device: none
Recipe for Self Magazine (US) (need help)

This recipe is almost finish, it need little clean up,
J do mistake with "remove_tags" (it doesn't remove what supposed to do)
if someone know how to fix this, feel free to do it !



Code:
class AdvancedUserRecipe1305547242(BasicNewsRecipe):
    title          = u'Self Magazine'
    oldest_article = 9
    max_articles_per_feed = 100
    no_stylesheets         = True
    use_embedded_content   = False
    remove_javascript      = True

    remove_tags = [dict(name='div', attrs={'class':'articles_footer', 'class':'printoptions'})]

    def print_version(self, url):
        return url + '?printable=true'

    def preprocess_html(self, soup):
        for alink in soup.findAll('a'):
            if alink.string is not None:
               tstr = alink.string
               alink.replaceWith(tstr)
        return soup

    feeds  = [	(u'Healthy, Happiness, Sex and Love', u'http://www.self.com/services/rss/feeds/health.xml'),
	(u'Beauty and Style', u'http://www.self.com/services/rss/feeds/beauty.xml'), 
	(u'Self Recipes', u'http://www.self.com/services/rss/feeds/recipes.xml'),
                    (u'Fitness and Workouts', u'http://www.self.com/services/rss/feeds/fitness.xml'),
                    (u'Healthy Stars', u'http://www.self.com/services/rss/feeds/healthystars.xml'),
                    (u'Lucys Blog', u'http://www.self.com/magazine/blogs/lucysblog/rss.xml'),
                    (u'Beyond the Beauty Pages', u'http://www.self.com/beauty/blogs/beyondthebeautypages/rss.xml'),
                    (u'Diet Like Me', u'http://www.self.com/fooddiet/blogs/dietlikeme/rss.xml'),
                    (u'Eat Like Me', u'http://www.self.com/fooddiet/blogs/eatlikeme/rss.xml'),
                    (u'SELF Style Secrets', u'http://www.self.com/beauty/blogs/selfstylesecrets/rss.xml'),
                    (u'SELFy Stars', u'http://www.self.com/magazine/blogs/selfystars/rss.xml'),
                    (u'Healthy SELF', u'http://www.self.com/services/rss/summary'),
                     ]
xXxXxXxXxXx is offline   Reply With Quote
Old 05-17-2011, 06:16 PM   #2
xXxXxXxXxXx
Enthusiast
xXxXxXxXxXx began at the beginning.
 
Posts: 37
Karma: 10
Join Date: Apr 2011
Device: none
J fix this on my own

Code:
class AdvancedUserRecipe1305547242(BasicNewsRecipe):
    title          = u'Self Magazine'
    oldest_article = 21
    max_articles_per_feed = 100
    no_stylesheets         = True
    use_embedded_content   = False
    remove_javascript      = True
    keep_only_tags = [dict(id=['printbody'])]
    

    def print_version(self, url):
        return url + '?printable=true'

    def preprocess_html(self, soup):
        for alink in soup.findAll('a'):
            if alink.string is not None:
               tstr = alink.string
               alink.replaceWith(tstr)
        return soup

    feeds  = [	(u'Healthy, Happiness, Sex and Love', u'http://www.self.com/services/rss/feeds/health.xml'),
	(u'Beauty and Style', u'http://www.self.com/services/rss/feeds/beauty.xml'), 
	(u'Self Recipes', u'http://www.self.com/services/rss/feeds/recipes.xml'),
                    (u'Fitness and Workouts', u'http://www.self.com/services/rss/feeds/fitness.xml'),
                    (u'Healthy Stars', u'http://www.self.com/services/rss/feeds/healthystars.xml'),
                    (u'Lucys Blog', u'http://www.self.com/magazine/blogs/lucysblog/rss.xml'),
                    (u'Beyond the Beauty Pages', u'http://www.self.com/beauty/blogs/beyondthebeautypages/rss.xml'),
                    (u'Diet Like Me', u'http://www.self.com/fooddiet/blogs/dietlikeme/rss.xml'),
                    (u'Eat Like Me', u'http://www.self.com/fooddiet/blogs/eatlikeme/rss.xml'),
                    (u'SELF Style Secrets', u'http://www.self.com/beauty/blogs/selfstylesecrets/rss.xml'),
                    (u'SELFy Stars', u'http://www.self.com/magazine/blogs/selfystars/rss.xml'),
                    (u'Healthy SELF', u'http://www.self.com/services/rss/summary'),
                     ]
xXxXxXxXxXx is offline   Reply With Quote
 
Advertisement
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Recipe for Caijing Magazine (zh-CN) gzeric Recipes 2 08-19-2011 05:59 PM
Recipe Request for World Magazine fbrian Recipes 3 06-05-2011 11:10 AM
SPIN Magazine recipe Quistopher Recipes 0 01-27-2011 10:04 PM
Create recipe for magazine BlonG Recipes 0 10-26-2010 08:46 AM
Custom Recipe for CNBC Magazine nittecat Calibre 1 02-28-2010 05:14 AM


All times are GMT -4. The time now is 07:31 PM.


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