mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
c212da613d
commit
c8b2795416
@ -1,14 +1,13 @@
|
|||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
import re
|
import re
|
||||||
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
from calibre.utils.magick import Image
|
||||||
from calibre.utils.magick import Image, PixelWand, create_canvas
|
|
||||||
|
|
||||||
|
|
||||||
''' Version 1.2, updated cover image to match the changed website.
|
''' Version 1.2, updated cover image to match the changed website.
|
||||||
added info date on title
|
added info date on title
|
||||||
version 1.4 Updated tags, delay and added autoclean 22-09-2011
|
version 1.4 Updated tags, delay and added autoclean 22-09-2011
|
||||||
version 1.5 Changes due to changes in site
|
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
|
Added som processing on pictures
|
||||||
Removed links in html
|
Removed links in html
|
||||||
Removed extre white characters
|
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 {width: 246px;margin-bottom: 5px;margin-left: 10px;}\
|
||||||
div.article-image-caption-2column {margin-bottom: 10px;width: 373px;} div.article-image-caption-3column {}\
|
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;}'
|
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']}),
|
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='div', attrs={'id':['date']}),
|
||||||
dict(name='h1', attrs={'class':['title']}),
|
dict(name='h1', attrs={'class':['title']}),
|
||||||
dict(name='h2', attrs={'class':['subtitle']})]
|
dict(name='h2', attrs={'class':['subtitle']})]
|
||||||
|
|
||||||
remove_tags = [dict(name='div', attrs={'class':[ 'metroCommentFormWrap',
|
remove_tags = [dict(name='div', attrs={'class':[ 'metroCommentFormWrap',
|
||||||
'commentForm', 'metroCommentInnerWrap', 'article-slideshow-counter-container', 'article-slideshow-control', 'ad', 'header-links',
|
'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']}),
|
'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 = Image()
|
||||||
img.open(iurl)
|
img.open(iurl)
|
||||||
#width, height = img.size
|
#width, height = img.size
|
||||||
#print '***img is: ', iurl, '\n****width is: ', width, 'height is: ', height
|
#print '***img is: ', iurl, '\n****width is: ', width, 'height is: ', height
|
||||||
pw = PixelWand()
|
|
||||||
img.trim(0)
|
img.trim(0)
|
||||||
img.save(iurl)
|
img.save(iurl)
|
||||||
'''
|
'''
|
||||||
#width, height = img.size
|
#width, height = img.size
|
||||||
#print '***TRIMMED img width is: ', width, 'height is: ', height
|
#print '***TRIMMED img width is: ', width, 'height is: ', height
|
||||||
left=0
|
left=0
|
||||||
top=0
|
top=0
|
||||||
border_color='#ffffff'
|
border_color='#ffffff'
|
||||||
width, height = img.size
|
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
|
height_correction = 1.17
|
||||||
canvas = create_canvas(width, height*height_correction,border_color)
|
canvas = create_canvas(width, height*height_correction,border_color)
|
||||||
canvas.compose(img, left, top)
|
canvas.compose(img, left, top)
|
||||||
#img = canvas
|
#img = canvas
|
||||||
canvas.save(iurl)
|
canvas.save(iurl)
|
||||||
#width, height = canvas.size
|
#width, height = canvas.size
|
||||||
#print '***NEW img width is: ', width, 'height is: ', height
|
#print '***NEW img width is: ', width, 'height is: ', height
|
||||||
'''
|
'''
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Binnenland', u'http://www.metronieuws.nl/rss.xml?c=1277377288-3'),
|
(u'Binnenland', u'http://www.metronieuws.nl/rss.xml?c=1277377288-3'),
|
||||||
(u'Economie', u'http://www.metronieuws.nl/rss.xml?c=1278070988-0'),
|
(u'Economie', u'http://www.metronieuws.nl/rss.xml?c=1278070988-0'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user