mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:More serbian recipes
This commit is contained in:
parent
59b0ac6762
commit
bcd4a9d98c
@ -14,6 +14,7 @@ recipe_modules = [
|
|||||||
'politika', 'moscow_times', 'latimes', 'japan_times', 'san_fran_chronicle',
|
'politika', 'moscow_times', 'latimes', 'japan_times', 'san_fran_chronicle',
|
||||||
'demorgen_be', 'de_standaard', 'ap', 'barrons', 'chr_mon', 'cnn', 'faznet',
|
'demorgen_be', 'de_standaard', 'ap', 'barrons', 'chr_mon', 'cnn', 'faznet',
|
||||||
'jpost', 'jutarnji', 'nasa', 'reuters', 'spiegelde', 'wash_post', 'zeitde',
|
'jpost', 'jutarnji', 'nasa', 'reuters', 'spiegelde', 'wash_post', 'zeitde',
|
||||||
|
'blic', 'novosti', 'danas', 'vreme',
|
||||||
]
|
]
|
||||||
|
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
|
@ -1,38 +1,60 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
b92.net
|
b92.net
|
||||||
'''
|
'''
|
||||||
|
import locale
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class B92(BasicNewsRecipe):
|
class B92(BasicNewsRecipe):
|
||||||
title = u'B92'
|
title = u'B92'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Dnevne vesti iz Srbije i sveta'
|
description = 'Dnevne vesti iz Srbije i sveta'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
remove_tags_after = dict(name='div', attrs={'class':'gas'})
|
try:
|
||||||
remove_tags = [
|
#Windows seting for locale
|
||||||
dict(name='div' , attrs={'class':'interaction clearfix' })
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
,dict(name='div' , attrs={'class':'gas' })
|
except locale.Error:
|
||||||
,dict(name='ul' , attrs={'class':'comment-nav' })
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
,dict(name='table', attrs={'class':'pages-navigation-form'})
|
try:
|
||||||
]
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
|
except locale.Error:
|
||||||
feeds = [
|
try:
|
||||||
(u'Vesti' , u'http://www.b92.net/info/rss/vesti.xml' )
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
,(u'Kultura' , u'http://www.b92.net/info/rss/kultura.xml' )
|
except locale.Error:
|
||||||
,(u'Automobili', u'http://www.b92.net/info/rss/automobili.xml')
|
try:
|
||||||
,(u'Zivot' , u'http://www.b92.net/info/rss/zivot.xml' )
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
,(u'Tehnopolis', u'http://www.b92.net/info/rss/tehnopolis.xml')
|
except locale.Error:
|
||||||
,(u'Biz' , u'http://www.b92.net/info/rss/biz.xml' )
|
try:
|
||||||
]
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
def print_version(self, url):
|
try:
|
||||||
return url + '&version=print'
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
remove_tags_after = dict(name='div', attrs={'class':'gas'})
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div' , attrs={'class':'interaction clearfix' })
|
||||||
|
,dict(name='div' , attrs={'class':'gas' })
|
||||||
|
,dict(name='ul' , attrs={'class':'comment-nav' })
|
||||||
|
,dict(name='table', attrs={'class':'pages-navigation-form'})
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Vesti' , u'http://www.b92.net/info/rss/vesti.xml' )
|
||||||
|
,(u'Kultura' , u'http://www.b92.net/info/rss/kultura.xml' )
|
||||||
|
,(u'Automobili', u'http://www.b92.net/info/rss/automobili.xml')
|
||||||
|
,(u'Zivot' , u'http://www.b92.net/info/rss/zivot.xml' )
|
||||||
|
,(u'Tehnopolis', u'http://www.b92.net/info/rss/tehnopolis.xml')
|
||||||
|
,(u'Biz' , u'http://www.b92.net/info/rss/biz.xml' )
|
||||||
|
]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
return url + '&version=print'
|
||||||
|
49
src/calibre/web/feeds/recipes/blic.py
Normal file
49
src/calibre/web/feeds/recipes/blic.py
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
blic.rs
|
||||||
|
'''
|
||||||
|
import locale
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Blic(BasicNewsRecipe):
|
||||||
|
title = u'Blic'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Vesti'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
timefmt = ' [%A, %d %B, %Y]'
|
||||||
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
|
try:
|
||||||
|
#Windows seting for locale
|
||||||
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
|
except locale.Error:
|
||||||
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
keep_only_tags = [ dict(name='div', attrs={'class':'single_news'}) ]
|
||||||
|
|
||||||
|
feeds = [ (u'Vesti', u'http://www.blic.rs/rssall.php')]
|
||||||
|
|
||||||
|
def print_version(self, url):
|
||||||
|
start_url, question, rest_url = url.partition('?')
|
||||||
|
return u'http://www.blic.rs/_print.php?' + rest_url
|
57
src/calibre/web/feeds/recipes/danas.py
Normal file
57
src/calibre/web/feeds/recipes/danas.py
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
danas.rs
|
||||||
|
'''
|
||||||
|
import locale
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Danas(BasicNewsRecipe):
|
||||||
|
title = u'Danas'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Vesti'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = False
|
||||||
|
use_embedded_content = False
|
||||||
|
timefmt = ' [%A, %d %B, %Y]'
|
||||||
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
|
try:
|
||||||
|
#Windows seting for locale
|
||||||
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
|
except locale.Error:
|
||||||
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
keep_only_tags = [ dict(name='div', attrs={'id':'left'}) ]
|
||||||
|
remove_tags_after = dict(name='div', attrs={'id':'comments'})
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div', attrs={'class':'width_1_4'})
|
||||||
|
,dict(name='div', attrs={'class':'metaClanka'})
|
||||||
|
,dict(name='div', attrs={'id':'comments'})
|
||||||
|
,dict(name='div', attrs={'class':'baner'})
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
feeds = [ (u'Vesti', u'http://www.danas.rs/rss/rss.asp')]
|
||||||
|
|
||||||
|
# def print_version(self, url):
|
||||||
|
# return url + '&action=print'
|
51
src/calibre/web/feeds/recipes/novosti.py
Normal file
51
src/calibre/web/feeds/recipes/novosti.py
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
novosti.rs
|
||||||
|
'''
|
||||||
|
import locale
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Novosti(BasicNewsRecipe):
|
||||||
|
title = u'Vecernje Novosti'
|
||||||
|
__author__ = u'Darko Miletic'
|
||||||
|
description = u'Vesti'
|
||||||
|
oldest_article = 7
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
use_embedded_content = False
|
||||||
|
timefmt = ' [%A, %d %B, %Y]'
|
||||||
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
|
try:
|
||||||
|
#Windows seting for locale
|
||||||
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
|
except locale.Error:
|
||||||
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
|
||||||
|
keep_only_tags = [ dict(name='div', attrs={'class':'jednaVest'}) ]
|
||||||
|
remove_tags_after = dict(name='div', attrs={'class':'info_bottom'})
|
||||||
|
remove_tags = [
|
||||||
|
dict(name='div', attrs={'class':'info'})
|
||||||
|
,dict(name='div', attrs={'class':'info_bottom'})
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [ (u'Vesti', u'http://www.novosti.rs/php/vesti/rss.php')]
|
@ -1,33 +1,56 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
politika.rs
|
politika.rs
|
||||||
'''
|
'''
|
||||||
|
import locale
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
class Politika(BasicNewsRecipe):
|
class Politika(BasicNewsRecipe):
|
||||||
title = u'Politika Online'
|
title = u'Politika Online'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Najstariji dnevni list na Balkanu'
|
description = 'Najstariji dnevni list na Balkanu'
|
||||||
oldest_article = 7
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
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]'
|
||||||
remove_tags_before = dict(name='div', attrs={'class':'content_center_border'})
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
remove_tags_after = dict(name='div', attrs={'class':'datum_item_details'})
|
try:
|
||||||
|
#Windows seting for locale
|
||||||
feeds = [
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
(u'Politika' , u'http://www.politika.rs/rubrike/Politika/index.1.lt.xml' )
|
except locale.Error:
|
||||||
,(u'Svet' , u'http://www.politika.rs/rubrike/Svet/index.1.lt.xml' )
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
,(u'Redakcijski komentari', u'http://www.politika.rs/rubrike/redakcijski-komentari/index.1.lt.xml')
|
try:
|
||||||
,(u'Pogledi' , u'http://www.politika.rs/pogledi/index.lt.xml' )
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
,(u'Pogledi sa strane' , u'http://www.politika.rs/rubrike/Pogledi-sa-strane/index.1.lt.xml' )
|
except locale.Error:
|
||||||
,(u'Tema dana' , u'http://www.politika.rs/rubrike/tema-dana/index.1.lt.xml' )
|
try:
|
||||||
,(u'Kultura' , u'http://www.politika.rs/rubrike/Kultura/index.1.lt.xml' )
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
,(u'Zivot i stil' , u'http://www.politika.rs/rubrike/zivot-i-stil/index.1.lt.xml' )
|
except locale.Error:
|
||||||
]
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
remove_tags_before = dict(name='div', attrs={'class':'content_center_border'})
|
||||||
|
remove_tags_after = dict(name='div', attrs={'class':'datum_item_details'})
|
||||||
|
|
||||||
|
feeds = [
|
||||||
|
(u'Politika' , u'http://www.politika.rs/rubrike/Politika/index.1.lt.xml' )
|
||||||
|
,(u'Svet' , u'http://www.politika.rs/rubrike/Svet/index.1.lt.xml' )
|
||||||
|
,(u'Redakcijski komentari', u'http://www.politika.rs/rubrike/redakcijski-komentari/index.1.lt.xml')
|
||||||
|
,(u'Pogledi' , u'http://www.politika.rs/pogledi/index.lt.xml' )
|
||||||
|
,(u'Pogledi sa strane' , u'http://www.politika.rs/rubrike/Pogledi-sa-strane/index.1.lt.xml' )
|
||||||
|
,(u'Tema dana' , u'http://www.politika.rs/rubrike/tema-dana/index.1.lt.xml' )
|
||||||
|
,(u'Kultura' , u'http://www.politika.rs/rubrike/Kultura/index.1.lt.xml' )
|
||||||
|
,(u'Zivot i stil' , u'http://www.politika.rs/rubrike/zivot-i-stil/index.1.lt.xml' )
|
||||||
|
]
|
||||||
|
76
src/calibre/web/feeds/recipes/vreme.py
Normal file
76
src/calibre/web/feeds/recipes/vreme.py
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
'''
|
||||||
|
vreme.com
|
||||||
|
'''
|
||||||
|
|
||||||
|
import string
|
||||||
|
import locale
|
||||||
|
from calibre import strftime
|
||||||
|
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||||
|
|
||||||
|
class Vreme(BasicNewsRecipe):
|
||||||
|
|
||||||
|
title = 'Vreme'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'Politicki Nedeljnik Srbije'
|
||||||
|
timefmt = ' [%A, %d %B, %Y]'
|
||||||
|
no_stylesheets = True
|
||||||
|
simultaneous_downloads = 1
|
||||||
|
delay = 1
|
||||||
|
needs_subscription = True
|
||||||
|
INDEX = 'http://www.vreme.com'
|
||||||
|
LOGIN = 'http://www.vreme.com/account/index.php'
|
||||||
|
#Locale setting to get appropriate date/month values in Serbian if possible
|
||||||
|
try:
|
||||||
|
#Windows seting for locale
|
||||||
|
locale.setlocale(locale.LC_TIME,'Serbian (Latin)')
|
||||||
|
except locale.Error:
|
||||||
|
#Linux setting for locale -- choose one appropriate for your distribution
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_YU')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_CS@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr@Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_Latn')
|
||||||
|
except locale.Error:
|
||||||
|
try:
|
||||||
|
locale.setlocale(locale.LC_TIME,'sr_RS')
|
||||||
|
except locale.Error:
|
||||||
|
locale.setlocale(locale.LC_TIME,'C')
|
||||||
|
|
||||||
|
def get_browser(self):
|
||||||
|
br = BasicNewsRecipe.get_browser()
|
||||||
|
if self.username is not None and self.password is not None:
|
||||||
|
br.open(self.LOGIN)
|
||||||
|
br.select_form(name='f')
|
||||||
|
br['username'] = self.username
|
||||||
|
br['password'] = self.password
|
||||||
|
br.submit()
|
||||||
|
return br
|
||||||
|
|
||||||
|
def parse_index(self):
|
||||||
|
articles = []
|
||||||
|
soup = self.index_to_soup(self.INDEX)
|
||||||
|
|
||||||
|
for item in soup.findAll('span', attrs={'class':'toc2'}):
|
||||||
|
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 = ''
|
||||||
|
articles.append({
|
||||||
|
'title':title,
|
||||||
|
'date':date,
|
||||||
|
'url':url,
|
||||||
|
'description':description
|
||||||
|
})
|
||||||
|
return [(soup.head.title.string, articles)]
|
Loading…
x
Reference in New Issue
Block a user