mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Mac World and Maximum PC
This commit is contained in:
parent
e719fb48fa
commit
984374825f
@ -34,20 +34,21 @@ class macWorld(BasicNewsRecipe):
|
|||||||
|
|
||||||
remove_javascript = True
|
remove_javascript = True
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
|
auto_cleanup = True
|
||||||
|
|
||||||
keep_only_tags = [
|
#keep_only_tags = [
|
||||||
dict(name='div', attrs={'id':'content'})
|
#dict(name='div', attrs={'id':'content'})
|
||||||
]
|
#]
|
||||||
|
|
||||||
remove_tags = [
|
#remove_tags = [
|
||||||
{'class':['toolBar','mac_tags','toolBar btmTools','textAds']},
|
#{'class':['toolBar','mac_tags','toolBar btmTools','textAds']},
|
||||||
dict(name='p', attrs={'class':'breadcrumbs'}),
|
#dict(name='p', attrs={'class':'breadcrumbs'}),
|
||||||
dict(id=['breadcrumb','sidebar','comments','topContentWrapper',
|
#dict(id=['breadcrumb','sidebar','comments','topContentWrapper',
|
||||||
'rightColumn', 'aboveFootPromo', 'storyCarousel']),
|
#'rightColumn', 'aboveFootPromo', 'storyCarousel']),
|
||||||
{'class':lambda x: x and ('tools' in x or 'toolBar'
|
#{'class':lambda x: x and ('tools' in x or 'toolBar'
|
||||||
in x)}
|
#in x)}
|
||||||
|
|
||||||
]
|
#]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'MacWorld Headlines', u'http://rss.macworld.com/macworld/news'),
|
(u'MacWorld Headlines', u'http://rss.macworld.com/macworld/news'),
|
||||||
@ -82,3 +83,4 @@ class macWorld(BasicNewsRecipe):
|
|||||||
.articleInfo {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
|
.articleInfo {color:#4D4D4D;font-family:Arial,Helvetica,sans-serif;font-size:10px; font-size-adjust:none; font-stretch:normal; font-style:bold; font-variant:normal; font-weight:bold; line-height:10px; text-decoration:none;}
|
||||||
img {align:left;}
|
img {align:left;}
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
from calibre.ptempfile import PersistentTemporaryFile
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class AdvancedUserRecipe1276930924(BasicNewsRecipe):
|
class AdvancedUserRecipe1276930924(BasicNewsRecipe):
|
||||||
@ -14,30 +13,30 @@ class AdvancedUserRecipe1276930924(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
language = 'en'
|
language = 'en'
|
||||||
temp_files = []
|
auto_cleanup = True
|
||||||
articles_are_obfuscated = True
|
feeds = [#(u'News', u'http://www.maximumpc.com/articles/all/feed'),
|
||||||
feeds = [(u'News', u'http://www.maximumpc.com/articles/4/feed'),
|
(u'News', u'http://www.maximumpc.com/articles/4/feed'),
|
||||||
(u'Reviews', u'http://www.maximumpc.com/articles/40/feed'),
|
(u'Reviews', u'http://www.maximumpc.com/articles/40/feed'),
|
||||||
(u'Editors Blog', u'http://www.maximumpc.com/articles/6/feed'),
|
(u'Editors Blog', u'http://www.maximumpc.com/articles/6/feed'),
|
||||||
(u'How-to', u'http://www.maximumpc.com/articles/32/feed'),
|
(u'How-to', u'http://www.maximumpc.com/articles/32/feed'),
|
||||||
(u'Features', u'http://www.maximumpc.com/articles/31/feed'),
|
(u'Features', u'http://www.maximumpc.com/articles/31/feed'),
|
||||||
(u'From the Magazine', u'http://www.maximumpc.com/articles/72/feed')
|
(u'From the Magazine', u'http://www.maximumpc.com/articles/72/feed')
|
||||||
]
|
]
|
||||||
keep_only_tags = [
|
#keep_only_tags = [
|
||||||
dict(name='div', attrs={'class':['print-title','article_body']}),
|
#dict(name='div', attrs={'class':['print-title','article_body']}),
|
||||||
]
|
#]
|
||||||
remove_tags = [
|
#remove_tags = [
|
||||||
dict(name='div', attrs={'class':'comments-tags-actions'}),
|
#dict(name='div', attrs={'class':'comments-tags-actions'}),
|
||||||
]
|
#]
|
||||||
remove_tags_before = dict(name='div', attrs={'class':'print-title'})
|
#remove_tags_before = dict(name='div', attrs={'class':'print-title'})
|
||||||
remove_tags_after = dict(name='div', attrs={'class':'meta-content'})
|
#remove_tags_after = dict(name='div', attrs={'class':'meta-content'})
|
||||||
|
|
||||||
def get_obfuscated_article(self, url):
|
#def get_obfuscated_article(self, url):
|
||||||
br = self.get_browser()
|
#br = self.get_browser()
|
||||||
br.open(url)
|
#br.open(url)
|
||||||
response = br.follow_link(url_regex = r'/print/[0-9]+', nr = 0)
|
#response = br.follow_link(url_regex = r'/print/[0-9]+', nr = 0)
|
||||||
html = response.read()
|
#html = response.read()
|
||||||
self.temp_files.append(PersistentTemporaryFile('_fa.html'))
|
#self.temp_files.append(PersistentTemporaryFile('_fa.html'))
|
||||||
self.temp_files[-1].write(html)
|
#self.temp_files[-1].write(html)
|
||||||
self.temp_files[-1].close()
|
#self.temp_files[-1].close()
|
||||||
return self.temp_files[-1].name
|
#return self.temp_files[-1].name
|
||||||
|
Loading…
x
Reference in New Issue
Block a user