From 613788f536e49bc7788ae9cc958b150f3e0e88bc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Jan 2013 21:39:35 +0530 Subject: [PATCH 1/3] Dob NeviNosti by DM. Fixes #1107941 (New recipe for serbian movie,tv blog - Doba Nevinosti) --- recipes/dobanevinosti.recipe | 46 ++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 recipes/dobanevinosti.recipe diff --git a/recipes/dobanevinosti.recipe b/recipes/dobanevinosti.recipe new file mode 100644 index 0000000000..976a1c0105 --- /dev/null +++ b/recipes/dobanevinosti.recipe @@ -0,0 +1,46 @@ + +__license__ = 'GPL v3' +__copyright__ = '2013, Darko Miletic ' +''' +dobanevinosti.blogspot.com +''' + +from calibre.web.feeds.news import BasicNewsRecipe + +class DobaNevinosti(BasicNewsRecipe): + title = 'Doba Nevinosti' + __author__ = 'Darko Miletic' + description = 'Filmski blog' + oldest_article = 15 + max_articles_per_feed = 100 + language = 'sr' + encoding = 'utf-8' + no_stylesheets = True + use_embedded_content = True + publication_type = 'blog' + auto_cleanup = True + extra_css = """ + @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} + body{font-family: "Trebuchet MS",Trebuchet,Verdana,sans1,sans-serif} + img{margin-bottom: 0.8em; display:block;} + """ + + conversion_options = { + 'comment' : description + , 'tags' : 'film, blog, srbija, tv' + , 'publisher': 'Dimitrije Vojinov' + , 'language' : language + } + remove_attributes = ['lang', 'border'] + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + feeds = [(u'Tekstovi', u'http://dobanevinosti.blogspot.com/feeds/posts/default')] + + def preprocess_html(self, soup): + for item in soup.findAll(style=True): + del item['style'] + for item in soup.findAll('img'): + if not item.has_key('alt'): + item['alt'] = 'image' + return soup + From 9c41150b511edbcd46ebf080611238b73fa8d5ee Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Jan 2013 21:41:07 +0530 Subject: [PATCH 2/3] ... --- src/calibre/web/feeds/news.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/web/feeds/news.py b/src/calibre/web/feeds/news.py index 22901f3ccc..5bf09d8a3b 100644 --- a/src/calibre/web/feeds/news.py +++ b/src/calibre/web/feeds/news.py @@ -422,7 +422,7 @@ class BasicNewsRecipe(Recipe): Times recipe to login for full access:: def get_browser(self): - br = BasicNewsRecipe.get_browser() + br = BasicNewsRecipe.get_browser(self) if self.username is not None and self.password is not None: br.open('http://www.nytimes.com/auth/login') br.select_form(name='login') From 7e4ada044692f93756c1f64db61d5e0d32c0e3fc Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 28 Jan 2013 21:54:40 +0530 Subject: [PATCH 3/3] Fix South China Morning Post --- recipes/scmp.recipe | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/recipes/scmp.recipe b/recipes/scmp.recipe index f2981ca667..6c66231da7 100644 --- a/recipes/scmp.recipe +++ b/recipes/scmp.recipe @@ -4,7 +4,6 @@ __copyright__ = '2010, Darko Miletic ' scmp.com ''' -import re from calibre.web.feeds.news import BasicNewsRecipe class SCMP(BasicNewsRecipe): @@ -18,10 +17,11 @@ class SCMP(BasicNewsRecipe): max_articles_per_feed = 200 no_stylesheets = True encoding = 'utf-8' + auto_cleanup = True use_embedded_content = False language = 'en_CN' remove_empty_feeds = True - needs_subscription = True + needs_subscription = 'optional' publication_type = 'newspaper' masthead_url = 'http://www.scmp.com/images/logo_scmp_home.gif' extra_css = ' body{font-family: Arial,Helvetica,sans-serif } ' @@ -46,17 +46,17 @@ class SCMP(BasicNewsRecipe): br.submit() return br - remove_attributes=['width','height','border'] + #remove_attributes=['width','height','border'] - keep_only_tags = [ - dict(attrs={'id':['ART','photoBox']}) - ,dict(attrs={'class':['article_label','article_byline','article_body']}) - ] + #keep_only_tags = [ + #dict(attrs={'id':['ART','photoBox']}) + #,dict(attrs={'class':['article_label','article_byline','article_body']}) + #] - preprocess_regexps = [ - (re.compile(r'

).)*', re.DOTALL|re.IGNORECASE), - lambda match: ''), - ] + #preprocess_regexps = [ + #(re.compile(r'

).)*', re.DOTALL|re.IGNORECASE), + #lambda match: ''), + #] feeds = [ (u'Business' , u'http://www.scmp.com/rss/business.xml' ) @@ -68,13 +68,13 @@ class SCMP(BasicNewsRecipe): ,(u'Sport' , u'http://www.scmp.com/rss/sport.xml' ) ] - def print_version(self, url): - rpart, sep, rest = url.rpartition('&') - return rpart #+ sep + urllib.quote_plus(rest) + #def print_version(self, url): + #rpart, sep, rest = url.rpartition('&') + #return rpart #+ sep + urllib.quote_plus(rest) - def preprocess_html(self, soup): - for item in soup.findAll(style=True): - del item['style'] - items = soup.findAll(src="/images/label_icon.gif") - [item.extract() for item in items] - return self.adeify_images(soup) + #def preprocess_html(self, soup): + #for item in soup.findAll(style=True): + #del item['style'] + #items = soup.findAll(src="/images/label_icon.gif") + #[item.extract() for item in items] + #return self.adeify_images(soup)