diff --git a/recipes/bash_org_pl.recipe b/recipes/bash_org_pl.recipe index 037870ed6c..4ed59614e7 100644 --- a/recipes/bash_org_pl.recipe +++ b/recipes/bash_org_pl.recipe @@ -1,15 +1,52 @@ from calibre.web.feeds.news import BasicNewsRecipe - class Bash_org_pl(BasicNewsRecipe): title = u'Bash.org.pl' __author__ = 'fenuks' description = 'Bash.org.pl - funny quotations from IRC discussions' category = 'funny quotations, humour' language = 'pl' - oldest_article = 15 cover_url = u'http://userlogos.org/files/logos/dzikiosiol/none_0.png' - max_articles_per_feed = 100 + max_articles_per_feed = 50 no_stylesheets= True - keep_only_tags= [dict(name='div', attrs={'class':'quote post-content post-body'})] - feeds = [(u'Cytaty', u'http://bash.org.pl/rss')] + keep_only_tags= [dict(name='a', attrs={'class':'qid click'}), + dict(name='div', attrs={'class':'quote post-content post-body'})] + + + def latest_articles(self): + articles = [] + soup=self.index_to_soup(u'http://bash.org.pl/latest/') + #date=soup.find('div', attrs={'class':'right'}).string + tags=soup.findAll('a', attrs={'class':'qid click'}) + for a in tags: + title=a.string + url='http://bash.org.pl' +a['href'] + articles.append({'title' : title, + 'url' : url, + 'date' : '', + 'description' : '' + }) + return articles + + + def random_articles(self): + articles = [] + for i in range(self.max_articles_per_feed): + soup=self.index_to_soup(u'http://bash.org.pl/random/') + #date=soup.find('div', attrs={'class':'right'}).string + url=soup.find('a', attrs={'class':'qid click'}) + title=url.string + url='http://bash.org.pl' +url['href'] + articles.append({'title' : title, + 'url' : url, + 'date' : '', + 'description' : '' + }) + return articles + + + def parse_index(self): + feeds = [] + feeds.append((u"Najnowsze", self.latest_articles())) + feeds.append((u"Losowe", self.random_articles())) + return feeds \ No newline at end of file diff --git a/recipes/dobreprogamy.recipe b/recipes/dobreprogamy.recipe index d9b2db591d..72f9c966bd 100644 --- a/recipes/dobreprogamy.recipe +++ b/recipes/dobreprogamy.recipe @@ -1,5 +1,5 @@ from calibre.web.feeds.news import BasicNewsRecipe - +import re class Dobreprogramy_pl(BasicNewsRecipe): title = 'Dobreprogramy.pl' @@ -15,6 +15,7 @@ class Dobreprogramy_pl(BasicNewsRecipe): extra_css = '.title {font-size:22px;}' oldest_article = 8 max_articles_per_feed = 100 + preprocess_regexps = [(re.compile(ur'