This commit is contained in:
Kovid Goyal 2010-09-26 12:30:19 -06:00
parent 0f341f5cd5
commit 8c2b672e6c
2 changed files with 20 additions and 21 deletions

View File

@ -1,5 +1,4 @@
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup, re
class AdvancedUserRecipe1282101454(BasicNewsRecipe): class AdvancedUserRecipe1282101454(BasicNewsRecipe):
title = 'Nealz Nuze' title = 'Nealz Nuze'
language = 'en' language = 'en'
@ -12,11 +11,11 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
linearize_tables = True linearize_tables = True
no_stylesheets = True no_stylesheets = True
remove_javascript = True remove_javascript = True
masthead_url = 'http://boortz.com/images/nuze_logo.gif' masthead_url = 'http://boortz.com/images/nuze_logo.gif'
keep_only_tags = [ keep_only_tags = [
dict(name='td', attrs={'id':['contentWellCell']}) dict(name='td', attrs={'id':['contentWellCell']})
] ]
remove_tags = [ remove_tags = [
dict(name='a', attrs={'class':['blogPermalink']}), dict(name='a', attrs={'class':['blogPermalink']}),
@ -26,13 +25,13 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
remove_tags_after = [dict(name='div', attrs={'class':'blogEntryBody'}),] remove_tags_after = [dict(name='div', attrs={'class':'blogEntryBody'}),]
feeds = [ feeds = [
('NUZE', 'http://boortz.com/nealz_nuze_rss/rss.xml') ('NUZE', 'http://boortz.com/nealz_nuze_rss/rss.xml')
] ]

View File

@ -1,5 +1,5 @@
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup, re from calibre.ebooks.BeautifulSoup import re
class AdvancedUserRecipe1282101454(BasicNewsRecipe): class AdvancedUserRecipe1282101454(BasicNewsRecipe):
title = 'Popular Science' title = 'Popular Science'
@ -13,35 +13,35 @@ class AdvancedUserRecipe1282101454(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
remove_javascript = True remove_javascript = True
use_embedded_content = True use_embedded_content = True
masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg' masthead_url = 'http://www.raytheon.com/newsroom/rtnwcm/groups/Public/documents/masthead/rtn08_popscidec_masthead.jpg'
feeds = [ feeds = [
('Gadgets', 'http://www.popsci.com/full-feed/gadgets'), ('Gadgets', 'http://www.popsci.com/full-feed/gadgets'),
('Cars', 'http://www.popsci.com/full-feed/cars'), ('Cars', 'http://www.popsci.com/full-feed/cars'),
('Science', 'http://www.popsci.com/full-feed/science'), ('Science', 'http://www.popsci.com/full-feed/science'),
('Technology', 'http://www.popsci.com/full-feed/technology'), ('Technology', 'http://www.popsci.com/full-feed/technology'),
('DIY', 'http://www.popsci.com/full-feed/diy'), ('DIY', 'http://www.popsci.com/full-feed/diy'),
] ]
#The following will get read of the Gallery: links when found #The following will get read of the Gallery: links when found
def preprocess_html(self, soup) : def preprocess_html(self, soup) :
print 'SOUP IS: ', soup print 'SOUP IS: ', soup
weblinks = soup.findAll(['head','h2']) weblinks = soup.findAll(['head','h2'])
if weblinks is not None: if weblinks is not None:
for link in weblinks: for link in weblinks:
if re.search('(Gallery)(:)',str(link)): if re.search('(Gallery)(:)',str(link)):
link.parent.extract() link.parent.extract()
return soup return soup
#----------------------------------------------------------------- #-----------------------------------------------------------------