diff --git a/src/calibre/gui2/images/news/dnevni_avaz.png b/src/calibre/gui2/images/news/dnevni_avaz.png new file mode 100644 index 0000000000..bfbddf387a Binary files /dev/null and b/src/calibre/gui2/images/news/dnevni_avaz.png differ diff --git a/src/calibre/gui2/images/news/glas_srpske.png b/src/calibre/gui2/images/news/glas_srpske.png new file mode 100644 index 0000000000..d9871856a3 Binary files /dev/null and b/src/calibre/gui2/images/news/glas_srpske.png differ diff --git a/src/calibre/web/feeds/recipes/__init__.py b/src/calibre/web/feeds/recipes/__init__.py index 0d1b72b9ca..d9d63ea0d3 100644 --- a/src/calibre/web/feeds/recipes/__init__.py +++ b/src/calibre/web/feeds/recipes/__init__.py @@ -36,7 +36,7 @@ recipe_modules = ['recipe_' + r for r in ( 'el_universal', 'mediapart', 'wikinews_en', 'ecogeek', 'daily_mail', 'new_york_review_of_books_no_sub', 'politico', 'adventuregamers', 'mondedurable', 'instapaper', 'dnevnik_cro', 'vecernji_list', - 'nacional_cro', '24sata', + 'nacional_cro', '24sata', 'dnevni_avaz', 'glas_srpske', )] import re, imp, inspect, time, os @@ -95,7 +95,7 @@ def compile_recipe(src): src = 'from %s.ebooks.lrf.web.profiles import DefaultProfile, FullContentProfile\n'%__appname__ + src src = '# coding: utf-8\n' + src src = 'from __future__ import with_statement\n' + src - + src = src.replace('from libprs500', 'from calibre').encode('utf-8') f.write(src) f.close() diff --git a/src/calibre/web/feeds/recipes/recipe_dnevni_avaz.py b/src/calibre/web/feeds/recipes/recipe_dnevni_avaz.py new file mode 100644 index 0000000000..5a55db9404 --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_dnevni_avaz.py @@ -0,0 +1,55 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +dnevniavaz.ba +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class DnevniAvaz(BasicNewsRecipe): + title = 'Dnevni Avaz' + __author__ = 'Darko Miletic' + description = 'Latest news from Bosnia' + publisher = 'Dnevni Avaz' + category = 'news, politics, Bosnia and Herzegovina' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + cover_url = 'http://www.dnevniavaz.ba/img/logo.gif' + lang = 'bs-BA' + language = _('Bosnian') + + extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: serif1, serif}' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"' + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + keep_only_tags = [dict(name='div', attrs={'id':['fullarticle-title','fullarticle-leading','fullarticle-date','fullarticle-text','articleauthor']})] + + remove_tags = [dict(name=['object','link','base'])] + + feeds = [ + (u'Najnovije' , u'http://www.dnevniavaz.ba/rss/novo' ) + ,(u'Najpopularnije', u'http://www.dnevniavaz.ba/rss/popularno') + ] + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mtag = '\n' + soup.head.insert(0,mtag) + return soup diff --git a/src/calibre/web/feeds/recipes/recipe_glas_srpske.py b/src/calibre/web/feeds/recipes/recipe_glas_srpske.py new file mode 100644 index 0000000000..c6329387ce --- /dev/null +++ b/src/calibre/web/feeds/recipes/recipe_glas_srpske.py @@ -0,0 +1,96 @@ +#!/usr/bin/env python + +__license__ = 'GPL v3' +__copyright__ = '2009, Darko Miletic ' + +''' +glassrpske.com +''' + +import re +from calibre.web.feeds.recipes import BasicNewsRecipe + +class GlasSrpske(BasicNewsRecipe): + title = 'Glas Srpske' + __author__ = 'Darko Miletic' + description = 'Latest news from republika srpska' + publisher = 'GLAS SRPSKE' + category = 'Novine, Dnevne novine, Vijesti, Novosti, Ekonomija, Sport, Crna Hronika, Banja Luka,, Republika Srpska, Bosna i Hercegovina' + oldest_article = 2 + max_articles_per_feed = 100 + no_stylesheets = True + encoding = 'utf-8' + use_embedded_content = False + remove_javascript = True + cover_url = 'http://www.glassrpske.com/var/slike/glassrpske-logo.png' + lang = 'sr-BA' + language = _('Serbian') + INDEX = 'http://www.glassrpske.com' + + extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{font-family: serif1, serif} .article_description{font-family: serif1, serif}' + + html2lrf_options = [ + '--comment', description + , '--category', category + , '--publisher', publisher + ] + + html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"' + + preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')] + + keep_only_tags = [dict(name='div', attrs={'class':'gl_cv paragraf'})] + + remove_tags = [dict(name=['object','link','base'])] + + feeds = [ + (u'Novosti' , u'http://www.glassrpske.com/vijest/2/novosti/lat/' ) + ,(u'Drustvo' , u'http://www.glassrpske.com/vijest/3/drustvo/lat/' ) + ,(u'Biznis' , u'http://www.glassrpske.com/vijest/4/ekonomija/lat/' ) + ,(u'Kroz RS' , u'http://www.glassrpske.com/vijest/5/krozrs/lat/' ) + ,(u'Hronika' , u'http://www.glassrpske.com/vijest/6/hronika/lat/' ) + ,(u'Srbija' , u'http://www.glassrpske.com/vijest/8/srbija/lat/' ) + ,(u'Region' , u'http://www.glassrpske.com/vijest/18/region/lat/' ) + ,(u'Svijet' , u'http://www.glassrpske.com/vijest/12/svijet/lat/' ) + ,(u'Kultura' , u'http://www.glassrpske.com/vijest/9/kultura/lat/' ) + ,(u'Banja Luka', u'http://www.glassrpske.com/vijest/10/banjaluka/lat/') + ,(u'Jet Set' , u'http://www.glassrpske.com/vijest/11/jetset/lat/' ) + ,(u'Muzika' , u'http://www.glassrpske.com/vijest/19/muzika/lat/' ) + ,(u'Sport' , u'http://www.glassrpske.com/vijest/13/sport/lat/' ) + ,(u'Kolumne' , u'http://www.glassrpske.com/vijest/16/kolumne/lat/' ) + ,(u'Plus' , u'http://www.glassrpske.com/vijest/7/plus/lat/' ) + ] + + def preprocess_html(self, soup): + soup.html['xml:lang'] = self.lang + soup.html['lang'] = self.lang + mtag = '\n' + soup.head.insert(0,mtag) + return soup + + def parse_index(self): + totalfeeds = [] + lfeeds = self.get_feeds() + for feedobj in lfeeds: + feedtitle, feedurl = feedobj + self.report_progress(0, _('Fetching feed')+' %s...'%(feedtitle if feedtitle else feedurl)) + articles = [] + soup = self.index_to_soup(feedurl) + for item in soup.findAll('div', attrs={'class':'gl_rub'}): + atag = item.find('a') + ptag = item.find('p') + datetag = item.find('span') + url = self.INDEX + atag['href'] + title = self.tag_to_string(atag) + description = self.tag_to_string(ptag) + date,sep,rest = self.tag_to_string(ptag).partition('|') + articles.append({ + 'title' :title + ,'date' :date + ,'url' :url + ,'description':description + }) + totalfeeds.append((feedtitle, articles)) + return totalfeeds + + \ No newline at end of file