From c8b27954166c9c2aa321ce2de0fc5e78943d92d1 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 27 Oct 2011 14:44:35 +0530 Subject: [PATCH] ... --- recipes/metro_news_nl.recipe | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/recipes/metro_news_nl.recipe b/recipes/metro_news_nl.recipe index 9ca337ed9e..3d12128e29 100644 --- a/recipes/metro_news_nl.recipe +++ b/recipes/metro_news_nl.recipe @@ -1,14 +1,13 @@ from calibre.web.feeds.news import BasicNewsRecipe import re -from calibre.ebooks.BeautifulSoup import BeautifulSoup -from calibre.utils.magick import Image, PixelWand, create_canvas +from calibre.utils.magick import Image ''' Version 1.2, updated cover image to match the changed website. added info date on title version 1.4 Updated tags, delay and added autoclean 22-09-2011 version 1.5 Changes due to changes in site - version 1.6 Added css, removed auto cleanup, added buitenland section, added use_embedded_content, added remove_attributes + version 1.6 Added css, removed auto cleanup, added buitenland section, added use_embedded_content, added remove_attributes Added som processing on pictures Removed links in html Removed extre white characters @@ -48,12 +47,12 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe): div.article-image-caption {width: 246px;margin-bottom: 5px;margin-left: 10px;}\ div.article-image-caption-2column {margin-bottom: 10px;width: 373px;} div.article-image-caption-3column {}\ img {border:0px;} .img-mask {position:absolute;top:0px;left:0px;}' - + keep_only_tags = [dict(name='div', attrs={'class':[ 'article-image-caption-2column', 'article-image-caption-3column', 'article-body', 'article-box-fact']}), dict(name='div', attrs={'id':['date']}), dict(name='h1', attrs={'class':['title']}), dict(name='h2', attrs={'class':['subtitle']})] - + remove_tags = [dict(name='div', attrs={'class':[ 'metroCommentFormWrap', 'commentForm', 'metroCommentInnerWrap', 'article-slideshow-counter-container', 'article-slideshow-control', 'ad', 'header-links', 'art-rgt','pluck-app pluck-comm', 'share-and-byline', 'article-tools-below-title', 'col-179 ', 'related-links', 'clear padding-top-15', 'share-tools', 'article-page-auto-pushes', 'footer-edit']}), @@ -72,28 +71,27 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe): img = Image() img.open(iurl) #width, height = img.size - #print '***img is: ', iurl, '\n****width is: ', width, 'height is: ', height - pw = PixelWand() + #print '***img is: ', iurl, '\n****width is: ', width, 'height is: ', height img.trim(0) img.save(iurl) ''' #width, height = img.size - #print '***TRIMMED img width is: ', width, 'height is: ', height + #print '***TRIMMED img width is: ', width, 'height is: ', height left=0 top=0 border_color='#ffffff' width, height = img.size - #print '***retrieved img width is: ', width, 'height is: ', height + #print '***retrieved img width is: ', width, 'height is: ', height height_correction = 1.17 canvas = create_canvas(width, height*height_correction,border_color) canvas.compose(img, left, top) #img = canvas canvas.save(iurl) #width, height = canvas.size - #print '***NEW img width is: ', width, 'height is: ', height + #print '***NEW img width is: ', width, 'height is: ', height ''' return soup - + feeds = [ (u'Binnenland', u'http://www.metronieuws.nl/rss.xml?c=1277377288-3'), (u'Economie', u'http://www.metronieuws.nl/rss.xml?c=1278070988-0'),