Fixed recipes for The LA Times and Budget Fashionista

This commit is contained in:
Kovid Goyal 2009-09-02 19:57:52 -06:00
parent 3e7df1bf84
commit 29337bac68
4 changed files with 34 additions and 45 deletions

View File

@ -272,6 +272,9 @@ class Py2App(object):
for f in glob.glob('src/calibre/plugins/*.so'):
shutil.copy2(f, dest)
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
@ -374,7 +377,7 @@ class Py2App(object):
@flush
def add_misc_libraries(self):
for x in ('usb', 'unrar'):
for x in ('usb', 'unrar', 'readline.6.0'):
print '\nAdding', x
x = 'lib%s.dylib'%x
shutil.copy2(join(SW, 'lib', x), self.frameworks_dir)

View File

@ -6,7 +6,7 @@ __docformat__ = 'restructuredtext en'
from calibre.gui2.convert.txt_output_ui import Ui_Form
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
newline_model = None

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
__copyright__ = '2008-2009, Darko Miletic <darko.miletic at gmail.com>'
'''
latimes.com
'''
@ -17,13 +17,19 @@ class LATimes(BasicNewsRecipe):
language = _('English')
no_stylesheets = True
use_embedded_content = False
encoding = 'utf-8'
lang = 'en-US'
keep_only_tags = [ dict(name='div', attrs={'id':'center' }) ]
remove_tags_after = [ dict(name='div', attrs={'id':'socialnet'}) ]
remove_tags = [
dict(name='div' , attrs={'id':'wrapper_vid' })
,dict(name='div' , attrs={'id':'article_related'})
,dict(name='div' , attrs={'id':'socialnet' })
]
conversion_options = {
'comment' : description
, 'language' : lang
}
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')]
def get_article_url(self, article):
return article.get('feedburner_origlink')

View File

@ -6,9 +6,7 @@ __copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
www.thebudgetfashionista.com
'''
import re
from calibre.web.feeds.recipes import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import Tag
class TheBudgetFashionista(BasicNewsRecipe):
title = 'The Budget Fashionista'
@ -24,40 +22,22 @@ class TheBudgetFashionista(BasicNewsRecipe):
lang = 'en-US'
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 = [
'--comment', description
, '--category', category
, '--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'})
]
keep_only_tags = [dict(name='div', attrs={'class':'columnLeft'})]
remove_tags_after = dict(name='div', attrs={'class':'postDetails'})
remove_tags = [dict(name=['object','link','script','iframe','form','login-button'])]
feeds = [(u'Articles', u'http://www.thebudgetfashionista.com/feeds/atom/')]
def preprocess_html(self, soup):
for item in soup.findAll(style=True):
del item['style']
return soup
for it in soup.findAll('img'):
if it.parent.name == 'a':
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)