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
'''
import locale
import string,re
from calibre.web.feeds.news import BasicNewsRecipe
class B92(BasicNewsRecipe):
@ -16,6 +16,8 @@ class B92(BasicNewsRecipe):
max_articles_per_feed = 100
no_stylesheets = True
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 = [

View File

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

View File

@ -1,42 +1,46 @@
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
jutarnji.hr
'''
from calibre.web.feeds.news import BasicNewsRecipe
class Jutarnji(BasicNewsRecipe):
title = u'Jutarnji'
__author__ = u'Darko Miletic'
description = u'Hrvatski portal'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'cp1250'
remove_tags = [dict(name='embed')]
feeds = [
(u'Naslovnica' , u'http://www.jutarnji.hr/rss' )
,(u'Sport' , u'http://www.jutarnji.hr/sport/rss' )
,(u'Jutarnji2' , u'http://www.jutarnji.hr/j2/rss' )
,(u'Kultura' , u'http://www.jutarnji.hr/kultura/rss' )
,(u'Spektakli' , u'http://www.jutarnji.hr/spektakli/rss' )
,(u'Dom i nekretnine', u'http://www.jutarnji.hr/nekretnine/rss')
,(u'Uhvati ritam' , u'http://www.jutarnji.hr/kalendar/rss' )
]
def print_version(self, url):
main = url.partition('.jl')[0]
rrest = main.rpartition(',')[-1]
return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + rrest
def preprocess_html(self, soup):
mtag = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
soup.head.insert(0,mtag)
return soup
#!/usr/bin/env python
__license__ = 'GPL v3'
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
jutarnji.hr
'''
import string, re
from calibre.web.feeds.news import BasicNewsRecipe
from calibre.ebooks.BeautifulSoup import BeautifulSoup
class Jutarnji(BasicNewsRecipe):
title = u'Jutarnji'
__author__ = u'Darko Miletic'
description = u'Hrvatski portal'
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
use_embedded_content = False
encoding = 'cp1250'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
remove_tags = [dict(name='embed')]
feeds = [
(u'Naslovnica' , u'http://www.jutarnji.hr/rss' )
,(u'Sport' , u'http://www.jutarnji.hr/sport/rss' )
,(u'Jutarnji2' , u'http://www.jutarnji.hr/j2/rss' )
,(u'Kultura' , u'http://www.jutarnji.hr/kultura/rss' )
,(u'Spektakli' , u'http://www.jutarnji.hr/spektakli/rss' )
,(u'Dom i nekretnine', u'http://www.jutarnji.hr/nekretnine/rss')
,(u'Uhvati ritam' , u'http://www.jutarnji.hr/kalendar/rss' )
]
def print_version(self, url):
main, split, rest = url.partition('.jl')
rmain, rsplit, rrest = main.rpartition(',')
return 'http://www.jutarnji.hr/ispis_clanka.jl?artid=' + rrest
def preprocess_html(self, soup):
mtag = '<meta http-equiv="Content-Type" content="text/html; charset=utf-8">'
soup.head.insert(0,mtag)
return soup

View File

@ -5,7 +5,7 @@ __copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
'''
novosti.rs
'''
import locale
import string,re
from calibre.web.feeds.news import BasicNewsRecipe
class Novosti(BasicNewsRecipe):
@ -18,6 +18,8 @@ class Novosti(BasicNewsRecipe):
use_embedded_content = False
timefmt = ' [%A, %d %B, %Y]'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
keep_only_tags = [ dict(name='div', attrs={'class':'jednaVest'}) ]
remove_tags_after = dict(name='div', attrs={'class':'info_bottom'})
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
'''
import locale
import string,re
from calibre.web.feeds.news import BasicNewsRecipe
class Politika(BasicNewsRecipe):
@ -18,6 +18,9 @@ class Politika(BasicNewsRecipe):
extra_css = '.content_center_border {text-align: left;}'
use_embedded_content = False
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_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
'''
import string
import locale
import string,re
from calibre import strftime
from calibre.web.feeds.recipes import BasicNewsRecipe
@ -24,6 +23,8 @@ class Vreme(BasicNewsRecipe):
INDEX = 'http://www.vreme.com'
LOGIN = 'http://www.vreme.com/account/index.php'
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
def get_browser(self):
br = BasicNewsRecipe.get_browser()
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)
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')
if feed_link and feed_link.has_key('href'):
url = self.INDEX+feed_link['href']+'&print=yes'
title = self.tag_to_string(feed_link)
date = strftime('%A, %d %B, %Y')
description = ''
url = self.INDEX + feed_link['href']
title = title_prefix + self.tag_to_string(feed_link)
date = strftime(self.timefmt)
articles.append({
'title':title,
'date':date,
'url':url,
'description':description
'title' :title
,'date' :date
,'url' :url
,'description':description
})
return [(soup.head.title.string, articles)]
def print_version(self, url):
return url + '&print=yes'