diff --git a/recipes/ekathemerini.recipe b/recipes/ekathemerini.recipe new file mode 100644 index 0000000000..25fa1d30b4 --- /dev/null +++ b/recipes/ekathemerini.recipe @@ -0,0 +1,58 @@ +from calibre.web.feeds.recipes import BasicNewsRecipe +from calibre.ebooks.BeautifulSoup import BeautifulSoup, BeautifulStoneSoup + +class Ekathimerini(BasicNewsRecipe): + title = 'ekathimerini' + __author__ = 'Thomas Scholl' + description = 'News from Greece, English edition' + masthead_url = 'http://wwk.kathimerini.gr/webadmin/EnglishNew/gifs/logo.gif' + max_articles_per_feed = 100 + oldest_article = 100 + publisher = 'Kathimerini' + category = 'news, GR' + language = 'en_GR' + encoding = 'windows-1253' + conversion_options = { 'linearize_tables': True} + no_stylesheets = True + delay = 1 + keep_only_tags = [dict(name='td', attrs={'class':'news'})] + + rss_url = 'http://ws.kathimerini.gr/xml_files/latestnews.xml' + + def find_articles(self, idx, category): + for article in idx.findAll('item'): + cat = u'' + cat_elem = article.find('subcat') + if cat_elem: + cat = self.tag_to_string(cat_elem) + + if cat == category: + desc_html = self.tag_to_string(article.find('description')) + description = self.tag_to_string(BeautifulSoup(desc_html)) + + a = { + 'title': self.tag_to_string(article.find('title')), + 'url': self.tag_to_string(article.find('link')), + 'description': description, + 'date' : self.tag_to_string(article.find('pubdate')), + } + yield a + + + def parse_index(self): + idx_contents = self.browser.open(self.rss_url).read() + idx = BeautifulStoneSoup(idx_contents, convertEntities=BeautifulStoneSoup.XML_ENTITIES) + + cats = list(set([self.tag_to_string(subcat) for subcat in idx.findAll('subcat')])) + cats.sort() + + feeds = [(u'News',list(self.find_articles(idx, u'')))] + + for cat in cats: + feeds.append((cat.capitalize(), list(self.find_articles(idx, cat)))) + + return feeds + + def print_version(self, url): + return url.replace('http://www.ekathimerini.com/4dcgi/', 'http://www.ekathimerini.com/4Dcgi/4dcgi/') + diff --git a/recipes/kstar.recipe b/recipes/kstar.recipe index fe44bfd679..6cf61a2484 100644 --- a/recipes/kstar.recipe +++ b/recipes/kstar.recipe @@ -1,7 +1,7 @@ from calibre.web.feeds.news import BasicNewsRecipe class AdvancedUserRecipe1282101454(BasicNewsRecipe): - title = 'Kansascity Star' + title = 'Kansas City Star' language = 'en' __author__ = 'TonytheBookworm' description = 'www.kansascity.com feed'