mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipe for The Budget Fashionista by Darko Miletic
This commit is contained in:
parent
ca9d095672
commit
45ed449af1
@ -45,6 +45,7 @@ recipe_modules = ['recipe_' + r for r in (
|
|||||||
'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts',
|
'straitstimes', 'index_hu', 'pcworld_hu', 'hrt', 'rts',
|
||||||
'h1', 'h2', 'h3', 'phd_comics', 'woz_die', 'elektrolese',
|
'h1', 'h2', 'h3', 'phd_comics', 'woz_die', 'elektrolese',
|
||||||
'climate_progress', 'carta', 'slashdot', 'publico',
|
'climate_progress', 'carta', 'slashdot', 'publico',
|
||||||
|
'the_budget_fashionista'
|
||||||
)]
|
)]
|
||||||
|
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
|
@ -23,11 +23,11 @@ class Publico(BasicNewsRecipe):
|
|||||||
feeds = [
|
feeds = [
|
||||||
(u'Geral', u'http://feeds.feedburner.com/PublicoUltimaHora'),
|
(u'Geral', u'http://feeds.feedburner.com/PublicoUltimaHora'),
|
||||||
(u'Internacional', u'http://www.publico.clix.pt/rss.ashx?idCanal=11'),
|
(u'Internacional', u'http://www.publico.clix.pt/rss.ashx?idCanal=11'),
|
||||||
(u'Política', u'http://www.publico.clix.pt/rss.ashx?idCanal=12'),
|
(u'Pol\xc3\xadtica', u'http://www.publico.clix.pt/rss.ashx?idCanal=12'),
|
||||||
(u'Ciências', u'http://www.publico.clix.pt/rss.ashx?idCanal=13'),
|
(u'Ci\xc3\xaancias', u'http://www.publico.clix.pt/rss.ashx?idCanal=13'),
|
||||||
(u'Desporto', u'http://desporto.publico.pt/rss.ashx'),
|
(u'Desporto', u'http://desporto.publico.pt/rss.ashx'),
|
||||||
(u'Economia', u'http://www.publico.clix.pt/rss.ashx?idCanal=57'),
|
(u'Economia', u'http://www.publico.clix.pt/rss.ashx?idCanal=57'),
|
||||||
(u'Educação', u'http://www.publico.clix.pt/rss.ashx?idCanal=58'),
|
(u'Educa\xc3\xa7\xc3\xa3o', u'http://www.publico.clix.pt/rss.ashx?idCanal=58'),
|
||||||
(u'Local', u'http://www.publico.clix.pt/rss.ashx?idCanal=59'),
|
(u'Local', u'http://www.publico.clix.pt/rss.ashx?idCanal=59'),
|
||||||
(u'Media e Tecnologia', u'http://www.publico.clix.pt/rss.ashx?idCanal=61'),
|
(u'Media e Tecnologia', u'http://www.publico.clix.pt/rss.ashx?idCanal=61'),
|
||||||
(u'Sociedade', u'http://www.publico.clix.pt/rss.ashx?idCanal=62')
|
(u'Sociedade', u'http://www.publico.clix.pt/rss.ashx?idCanal=62')
|
||||||
|
@ -0,0 +1,63 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__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'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Saving your money since 2003'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
encoding = 'utf-8'
|
||||||
|
publisher = 'TBF GROUP, LLC.'
|
||||||
|
category = 'news, fashion, comsetics, women'
|
||||||
|
lang = 'en-US'
|
||||||
|
language = _('English')
|
||||||
|
|
||||||
|
preprocess_regexps = [(re.compile(r"</head>{0,1}", re.DOTALL|re.IGNORECASE),lambda match: '')]
|
||||||
|
|
||||||
|
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'})
|
||||||
|
]
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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