mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix #6419 (Updated recipes for NSPM and NSPM in English)
This commit is contained in:
parent
1bbe4ce93e
commit
bd3048f3ab
@ -14,33 +14,39 @@ class Nspm(BasicNewsRecipe):
|
|||||||
description = 'Casopis za politicku teoriju i drustvena istrazivanja'
|
description = 'Casopis za politicku teoriju i drustvena istrazivanja'
|
||||||
publisher = 'NSPM'
|
publisher = 'NSPM'
|
||||||
category = 'news, politics, Serbia'
|
category = 'news, politics, Serbia'
|
||||||
oldest_article = 2
|
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
|
||||||
INDEX = 'http://www.nspm.rs/?alphabet=l'
|
INDEX = 'http://www.nspm.rs/?alphabet=l'
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
language = 'sr'
|
language = 'sr'
|
||||||
|
delay = 2
|
||||||
publication_type = 'magazine'
|
publication_type = 'magazine'
|
||||||
masthead_url = 'http://www.nspm.rs/templates/jsn_epic_pro/images/logol.jpg'
|
masthead_url = 'http://www.nspm.rs/templates/jsn_epic_pro/images/logol.jpg'
|
||||||
extra_css = ' @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} body{font-family: "Times New Roman", serif1, serif} .article_description{font-family: Arial, sans1, sans-serif} img{margin-top:0.5em; margin-bottom: 0.7em} .author{color: #990000; font-weight: bold} .author,.createdate{font-size: 0.9em} img{margin-top:0.5em; margin-bottom: 0.7em} '
|
extra_css = """ @font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)}
|
||||||
|
@font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)}
|
||||||
|
body{font-family: "Times New Roman", serif1, serif}
|
||||||
|
.article_description{font-family: Arial, sans1, sans-serif}
|
||||||
|
img{margin-top:0.5em; margin-bottom: 0.7em}
|
||||||
|
.author{color: #990000; font-weight: bold}
|
||||||
|
.author,.createdate{font-size: 0.9em} """
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
, 'tags' : category
|
, 'tags' : category
|
||||||
, 'publisher' : publisher
|
, 'publisher' : publisher
|
||||||
, 'language' : language
|
, 'language' : language
|
||||||
|
, 'linearize_tables' : True
|
||||||
}
|
}
|
||||||
|
|
||||||
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
||||||
|
keep_only_tags = [dict(attrs={'id':'jsn-mainbody'})]
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['link','object','embed','script','meta'])
|
dict(name=['link','object','embed','script','meta','base','iframe'])
|
||||||
,dict(name='td', attrs={'class':'buttonheading'})
|
,dict(attrs={'class':'buttonheading'})
|
||||||
]
|
]
|
||||||
keep_only_tags = [
|
remove_tags_after = dict(attrs={'class':'article_separator'})
|
||||||
dict(attrs={'class':['contentpagetitle','author','createdate']})
|
|
||||||
,dict(name='p')
|
|
||||||
]
|
|
||||||
remove_attributes = ['width','height']
|
remove_attributes = ['width','height']
|
||||||
|
|
||||||
def get_browser(self):
|
def get_browser(self):
|
||||||
@ -48,25 +54,18 @@ class Nspm(BasicNewsRecipe):
|
|||||||
br.open(self.INDEX)
|
br.open(self.INDEX)
|
||||||
return br
|
return br
|
||||||
|
|
||||||
feeds = [(u'Nova srpska politicka misao', u'http://www.nspm.rs/feed/rss.html')]
|
feeds = [
|
||||||
|
(u'Rubrike' , u'http://www.nspm.rs/rubrike/feed/rss.html')
|
||||||
def print_version(self, url):
|
,(u'Debate' , u'http://www.nspm.rs/debate/feed/rss.html')
|
||||||
return url.replace('.html','/stampa.html')
|
,(u'Reci i misli' , u'http://www.nspm.rs/reci-i-misli/feed/rss.html')
|
||||||
|
,(u'Samo smeh srbina spasava', u'http://www.nspm.rs/samo-smeh-srbina-spasava/feed/rss.html')
|
||||||
|
,(u'Polemike' , u'http://www.nspm.rs/polemike/feed/rss.html')
|
||||||
|
,(u'Prikazi' , u'http://www.nspm.rs/prikazi/feed/rss.html')
|
||||||
|
,(u'Prenosimo' , u'http://www.nspm.rs/prenosimo/feed/rss.html')
|
||||||
|
,(u'Hronika' , u'http://www.nspm.rs/tabela/hronika/feed/rss.html')
|
||||||
|
]
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
for item in soup.body.findAll(style=True):
|
for item in soup.body.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
att = soup.find('a',attrs={'class':'contentpagetitle'})
|
return self.adeify_images(soup)
|
||||||
if att:
|
|
||||||
att.name = 'h1';
|
|
||||||
del att['href']
|
|
||||||
att2 = soup.find('td')
|
|
||||||
if att2:
|
|
||||||
att2.name = 'p';
|
|
||||||
del att['valign']
|
|
||||||
for pt in soup.findAll('img'):
|
|
||||||
brtag = Tag(soup,'br')
|
|
||||||
brtag2 = Tag(soup,'br')
|
|
||||||
pt.append(brtag)
|
|
||||||
pt.append(brtag2)
|
|
||||||
return soup
|
|
@ -1,7 +1,5 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008-2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
nspm.rs/nspm-in-english
|
nspm.rs/nspm-in-english
|
||||||
'''
|
'''
|
||||||
@ -11,29 +9,44 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
class Nspm_int(BasicNewsRecipe):
|
class Nspm_int(BasicNewsRecipe):
|
||||||
title = 'NSPM in English'
|
title = 'NSPM in English'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'Magazine dedicated to political theory and sociological research'
|
description = 'Magazine dedicated to political theory and sociological research'
|
||||||
oldest_article = 20
|
publisher = 'NSPM'
|
||||||
|
category = 'news, politics, Serbia'
|
||||||
|
oldest_article = 7
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
language = 'en'
|
|
||||||
|
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
INDEX = 'http://www.nspm.rs/?alphabet=l'
|
encoding = 'utf-8'
|
||||||
cover_url = 'http://nspm.rs/templates/jsn_epic_pro/images/logol.jpg'
|
language = 'en'
|
||||||
html2lrf_options = [
|
delay = 2
|
||||||
'--comment', description
|
publication_type = 'magazine'
|
||||||
, '--base-font-size', '10'
|
masthead_url = 'http://www.nspm.rs/templates/jsn_epic_pro/images/logol.jpg'
|
||||||
, '--category', 'news, politics, Serbia, english'
|
extra_css = """
|
||||||
, '--publisher', 'IIC NSPM'
|
body{font-family: "Times New Roman", serif}
|
||||||
]
|
.article_description{font-family: Arial, sans-serif}
|
||||||
|
img{margin-top:0.5em; margin-bottom: 0.7em}
|
||||||
|
.author{color: #990000; font-weight: bold}
|
||||||
|
.author,.createdate{font-size: 0.9em} """
|
||||||
|
|
||||||
def get_browser(self):
|
conversion_options = {
|
||||||
br = BasicNewsRecipe.get_browser()
|
'comment' : description
|
||||||
br.open(self.INDEX)
|
, 'tags' : category
|
||||||
return br
|
, 'publisher' : publisher
|
||||||
|
, 'language' : language
|
||||||
|
, 'linearize_tables' : True
|
||||||
|
}
|
||||||
|
|
||||||
|
keep_only_tags = [dict(attrs={'id':'jsn-mainbody'})]
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['link','object','embed','script','meta','base','iframe'])
|
||||||
|
,dict(attrs={'class':'buttonheading'})
|
||||||
|
]
|
||||||
|
remove_tags_after = dict(attrs={'class':'article_separator'})
|
||||||
|
remove_attributes = ['width','height']
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'id':'jsn-mainbody'})]
|
feeds = [(u'Articles', u'http://www.nspm.rs/nspm-in-english/feed/rss.html')]
|
||||||
remove_tags = [dict(name='div', attrs={'id':'yvComment' })]
|
|
||||||
|
|
||||||
feeds = [ (u'NSPM in English', u'http://nspm.rs/nspm-in-english/feed/rss.html')]
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.body.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
return self.adeify_images(soup)
|
Loading…
x
Reference in New Issue
Block a user