Updated serbian and croation recipes

This commit is contained in:
Kovid Goyal 2008-12-07 11:53:00 -08:00
parent 642ac41a57
commit acf525d22d
14 changed files with 119 additions and 60 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 413 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 738 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 709 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 362 B

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
''' '''
b92.net b92.net
''' '''
import locale import string,re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class B92(BasicNewsRecipe): class B92(BasicNewsRecipe):
@ -17,6 +17,8 @@ class B92(BasicNewsRecipe):
no_stylesheets = True no_stylesheets = True
use_embedded_content = False use_embedded_content = False
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
remove_tags_after = dict(name='div', attrs={'class':'gas'}) remove_tags_after = dict(name='div', attrs={'class':'gas'})
remove_tags = [ remove_tags = [
dict(name='div' , attrs={'class':'interaction clearfix' }) dict(name='div' , attrs={'class':'interaction clearfix' })

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
''' '''
blic.rs blic.rs
''' '''
import locale import string,re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Blic(BasicNewsRecipe): class Blic(BasicNewsRecipe):
@ -18,6 +18,8 @@ class Blic(BasicNewsRecipe):
use_embedded_content = False use_embedded_content = False
timefmt = ' [%A, %d %B, %Y]' timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
keep_only_tags = [ dict(name='div', attrs={'class':'single_news'}) ] keep_only_tags = [ dict(name='div', attrs={'class':'single_news'}) ]
feeds = [ (u'Vesti', u'http://www.blic.rs/rssall.php')] feeds = [ (u'Vesti', u'http://www.blic.rs/rssall.php')]

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
''' '''
danas.rs danas.rs
''' '''
import locale import string,re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Danas(BasicNewsRecipe): class Danas(BasicNewsRecipe):
@ -14,10 +14,12 @@ class Danas(BasicNewsRecipe):
description = 'Vesti' description = 'Vesti'
oldest_article = 7 oldest_article = 7
max_articles_per_feed = 100 max_articles_per_feed = 100
no_stylesheets = False no_stylesheets = True
use_embedded_content = False use_embedded_content = False
timefmt = ' [%A, %d %B, %Y]' timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
keep_only_tags = [ dict(name='div', attrs={'id':'left'}) ] keep_only_tags = [ dict(name='div', attrs={'id':'left'}) ]
remove_tags_after = dict(name='div', attrs={'id':'comments'}) remove_tags_after = dict(name='div', attrs={'id':'comments'})
remove_tags = [ remove_tags = [
@ -30,6 +32,3 @@ class Danas(BasicNewsRecipe):
feeds = [ (u'Vesti', u'http://www.danas.rs/rss/rss.asp')] feeds = [ (u'Vesti', u'http://www.danas.rs/rss/rss.asp')]
# def print_version(self, url):
# return url + '&action=print'

View File

@ -6,7 +6,9 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
jutarnji.hr jutarnji.hr
''' '''
import string, re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
class Jutarnji(BasicNewsRecipe): class Jutarnji(BasicNewsRecipe):
title = u'Jutarnji' title = u'Jutarnji'
@ -18,6 +20,8 @@ class Jutarnji(BasicNewsRecipe):
use_embedded_content = False use_embedded_content = False
encoding = 'cp1250' encoding = 'cp1250'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
remove_tags = [dict(name='embed')] remove_tags = [dict(name='embed')]
feeds = [ feeds = [
@ -31,8 +35,8 @@ class Jutarnji(BasicNewsRecipe):
] ]
def print_version(self, url): def print_version(self, url):
main = url.partition('.jl')[0] main, split, rest = url.partition('.jl')
rrest = main.rpartition(',')[-1] rmain, rsplit, rrest = main.rpartition(',')
return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + rrest return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + rrest
def preprocess_html(self, soup): def preprocess_html(self, soup):

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
''' '''
novosti.rs novosti.rs
''' '''
import locale import string,re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Novosti(BasicNewsRecipe): class Novosti(BasicNewsRecipe):
@ -18,6 +18,8 @@ class Novosti(BasicNewsRecipe):
use_embedded_content = False use_embedded_content = False
timefmt = ' [%A, %d %B, %Y]' timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
keep_only_tags = [ dict(name='div', attrs={'class':'jednaVest'}) ] keep_only_tags = [ dict(name='div', attrs={'class':'jednaVest'}) ]
remove_tags_after = dict(name='div', attrs={'class':'info_bottom'}) remove_tags_after = dict(name='div', attrs={'class':'info_bottom'})
remove_tags = [ remove_tags = [

View File

@ -0,0 +1,33 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
nspm.rs
'''
import string,re
from calibre.web.feeds.news import BasicNewsRecipe
class Nspm(BasicNewsRecipe):
title = u'Nova srpska politicka misao'
__author__ = 'Darko Miletic'
description = 'Casopis za politicku teoriju i drustvena istrazivanja'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
INDEX = 'http://www.nspm.rs/?alphabet=l'
timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
def get_browser(self):
br = BasicNewsRecipe.get_browser()
br.open(self.INDEX)
return br
feeds = [ (u'Nova srpska politicka misao', u'http://www.nspm.rs/feed/rss.html')]
def print_version(self, url):
return url.replace('.html','/stampa.html')

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
''' '''
politika.rs politika.rs
''' '''
import locale import string,re
from calibre.web.feeds.news import BasicNewsRecipe from calibre.web.feeds.news import BasicNewsRecipe
class Politika(BasicNewsRecipe): class Politika(BasicNewsRecipe):
@ -18,6 +18,9 @@ class Politika(BasicNewsRecipe):
extra_css = '.content_center_border {text-align: left;}' extra_css = '.content_center_border {text-align: left;}'
use_embedded_content = False use_embedded_content = False
timefmt = ' [%A, %d %B, %Y]' timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
remove_tags_before = dict(name='div', attrs={'class':'content_center_border'}) remove_tags_before = dict(name='div', attrs={'class':'content_center_border'})
remove_tags_after = dict(name='div', attrs={'class':'datum_item_details'}) remove_tags_after = dict(name='div', attrs={'class':'datum_item_details'})

View File

@ -6,8 +6,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
vreme.com vreme.com
''' '''
import string import string,re
import locale
from calibre import strftime from calibre import strftime
from calibre.web.feeds.recipes import BasicNewsRecipe from calibre.web.feeds.recipes import BasicNewsRecipe
@ -24,6 +23,8 @@ class Vreme(BasicNewsRecipe):
INDEX = 'http://www.vreme.com' INDEX = 'http://www.vreme.com'
LOGIN = 'http://www.vreme.com/account/index.php' LOGIN = 'http://www.vreme.com/account/index.php'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
def get_browser(self): def get_browser(self):
br = BasicNewsRecipe.get_browser() br = BasicNewsRecipe.get_browser()
if self.username is not None and self.password is not None: if self.username is not None and self.password is not None:
@ -39,16 +40,29 @@ class Vreme(BasicNewsRecipe):
soup = self.index_to_soup(self.INDEX) soup = self.index_to_soup(self.INDEX)
for item in soup.findAll('span', attrs={'class':'toc2'}): for item in soup.findAll('span', attrs={'class':'toc2'}):
description = ''
title_prefix = ''
descript_title_tag = item.findPreviousSibling('span', attrs={'class':'toc1'})
if descript_title_tag:
title_prefix = self.tag_to_string(descript_title_tag) + ' '
descript_tag = item.findNextSibling('span', attrs={'class':'toc3'})
if descript_tag:
description = self.tag_to_string(descript_tag)
feed_link = item.find('a') feed_link = item.find('a')
if feed_link and feed_link.has_key('href'): if feed_link and feed_link.has_key('href'):
url = self.INDEX+feed_link['href']+'&print=yes' url = self.INDEX + feed_link['href']
title = self.tag_to_string(feed_link) title = title_prefix + self.tag_to_string(feed_link)
date = strftime('%A, %d %B, %Y') date = strftime(self.timefmt)
description = ''
articles.append({ articles.append({
'title':title, 'title' :title
'date':date, ,'date' :date
'url':url, ,'url' :url
'description':description ,'description':description
}) })
return [(soup.head.title.string, articles)] return [(soup.head.title.string, articles)]
def print_version(self, url):
return url + '&print=yes'