mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fixed recipes for The LA Times and Budget Fashionista
This commit is contained in:
parent
3e7df1bf84
commit
29337bac68
@ -272,6 +272,9 @@ class Py2App(object):
|
|||||||
for f in glob.glob('src/calibre/plugins/*.so'):
|
for f in glob.glob('src/calibre/plugins/*.so'):
|
||||||
shutil.copy2(f, dest)
|
shutil.copy2(f, dest)
|
||||||
self.fix_dependencies_in_lib(join(dest, basename(f)))
|
self.fix_dependencies_in_lib(join(dest, basename(f)))
|
||||||
|
if 'podofo' in f:
|
||||||
|
self.change_dep('libpodofo.0.6.99.dylib',
|
||||||
|
self.FID+'/'+'libpodofo.0.6.99.dylib', join(dest, basename(f)))
|
||||||
|
|
||||||
|
|
||||||
@flush
|
@flush
|
||||||
@ -374,7 +377,7 @@ class Py2App(object):
|
|||||||
|
|
||||||
@flush
|
@flush
|
||||||
def add_misc_libraries(self):
|
def add_misc_libraries(self):
|
||||||
for x in ('usb', 'unrar'):
|
for x in ('usb', 'unrar', 'readline.6.0'):
|
||||||
print '\nAdding', x
|
print '\nAdding', x
|
||||||
x = 'lib%s.dylib'%x
|
x = 'lib%s.dylib'%x
|
||||||
shutil.copy2(join(SW, 'lib', x), self.frameworks_dir)
|
shutil.copy2(join(SW, 'lib', x), self.frameworks_dir)
|
||||||
|
@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
from calibre.gui2.convert.txt_output_ui import Ui_Form
|
from calibre.gui2.convert.txt_output_ui import Ui_Form
|
||||||
from calibre.gui2.convert import Widget
|
from calibre.gui2.convert import Widget
|
||||||
from calibre.ebooks.txt.writer import TxtNewlines
|
from calibre.ebooks.txt.newlines import TxtNewlines
|
||||||
from calibre.gui2.widgets import BasicComboModel
|
from calibre.gui2.widgets import BasicComboModel
|
||||||
|
|
||||||
newline_model = None
|
newline_model = None
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
latimes.com
|
latimes.com
|
||||||
'''
|
'''
|
||||||
@ -14,16 +14,22 @@ class LATimes(BasicNewsRecipe):
|
|||||||
description = u'News from Los Angeles'
|
description = u'News from Los Angeles'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
language = _('English')
|
language = _('English')
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
|
encoding = 'utf-8'
|
||||||
|
lang = 'en-US'
|
||||||
|
|
||||||
keep_only_tags = [ dict(name='div', attrs={'id':'center' }) ]
|
conversion_options = {
|
||||||
remove_tags_after = [ dict(name='div', attrs={'id':'socialnet'}) ]
|
'comment' : description
|
||||||
remove_tags = [
|
, 'language' : lang
|
||||||
dict(name='div' , attrs={'id':'wrapper_vid' })
|
}
|
||||||
,dict(name='div' , attrs={'id':'article_related'})
|
|
||||||
,dict(name='div' , attrs={'id':'socialnet' })
|
keep_only_tags = [dict(name='div', attrs={'class':'story' })]
|
||||||
]
|
remove_tags_after = [dict(name='div', attrs={'id':'story-body' })]
|
||||||
|
remove_tags = [dict(name='div', attrs={'class':['thumbnail','articlerail','tools']})]
|
||||||
|
|
||||||
feeds = [(u'News', u'http://feeds.latimes.com/latimes/news')]
|
feeds = [(u'News', u'http://feeds.latimes.com/latimes/news')]
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('feedburner_origlink')
|
||||||
|
@ -6,9 +6,7 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
|||||||
www.thebudgetfashionista.com
|
www.thebudgetfashionista.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
import re
|
|
||||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
|
||||||
|
|
||||||
class TheBudgetFashionista(BasicNewsRecipe):
|
class TheBudgetFashionista(BasicNewsRecipe):
|
||||||
title = 'The Budget Fashionista'
|
title = 'The Budget Fashionista'
|
||||||
@ -24,40 +22,22 @@ class TheBudgetFashionista(BasicNewsRecipe):
|
|||||||
lang = 'en-US'
|
lang = 'en-US'
|
||||||
language = _('English')
|
language = _('English')
|
||||||
|
|
||||||
preprocess_regexps = [(re.compile(r"</head>{0,1}", re.DOTALL|re.IGNORECASE),lambda match: '')]
|
conversion_options = {
|
||||||
|
'comment' : description
|
||||||
|
, 'tags' : category
|
||||||
|
, 'publisher' : publisher
|
||||||
|
, 'language' : lang
|
||||||
|
}
|
||||||
|
|
||||||
html2lrf_options = [
|
keep_only_tags = [dict(name='div', attrs={'class':'columnLeft'})]
|
||||||
'--comment', description
|
remove_tags_after = dict(name='div', attrs={'class':'postDetails'})
|
||||||
, '--category', category
|
remove_tags = [dict(name=['object','link','script','iframe','form','login-button'])]
|
||||||
, '--publisher', publisher
|
|
||||||
]
|
|
||||||
|
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':'singlepost'})]
|
|
||||||
remove_tags_after = dict(name='div', attrs={'id':'postnav'})
|
|
||||||
remove_tags = [
|
|
||||||
dict(name=['object','link','script','iframe','form'])
|
|
||||||
,dict(name='div', attrs={'id':'postnav'})
|
|
||||||
]
|
|
||||||
|
|
||||||
feeds = [(u'Articles', u'http://www.thebudgetfashionista.com/feeds/atom/')]
|
feeds = [(u'Articles', u'http://www.thebudgetfashionista.com/feeds/atom/')]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for item in soup.findAll(style=True):
|
for it in soup.findAll('img'):
|
||||||
del item['style']
|
if it.parent.name == 'a':
|
||||||
return soup
|
it.parent.name = 'div'
|
||||||
|
return soup;
|
||||||
|
|
||||||
def postprocess_html(self, soup, x):
|
|
||||||
body = soup.find('body')
|
|
||||||
post = soup.find('div', attrs={'id':'singlepost'})
|
|
||||||
if post and body:
|
|
||||||
post.extract()
|
|
||||||
body.extract()
|
|
||||||
soup.html.append(body)
|
|
||||||
body.insert(1,post)
|
|
||||||
mlang = Tag(soup,'meta',[("http-equiv","Content-Language"),("content",self.lang)])
|
|
||||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
||||||
soup.head.insert(0,mlang)
|
|
||||||
soup.head.insert(1,mcharset)
|
|
||||||
return self.adeify_images(soup)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user