mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
New recipes for E-Novine and Al Jazeera by Darko Miletic
This commit is contained in:
parent
40c50665c5
commit
544346837c
BIN
src/calibre/gui2/images/news/e_novine.png
Normal file
BIN
src/calibre/gui2/images/news/e_novine.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 295 B |
@ -30,7 +30,8 @@ recipe_modules = ['recipe_' + r for r in (
|
|||||||
'honoluluadvertiser', 'starbulletin', 'exiled', 'indy_star', 'dna',
|
'honoluluadvertiser', 'starbulletin', 'exiled', 'indy_star', 'dna',
|
||||||
'pobjeda', 'chicago_breaking_news', 'glasgow_herald', 'linuxdevices',
|
'pobjeda', 'chicago_breaking_news', 'glasgow_herald', 'linuxdevices',
|
||||||
'hindu', 'cincinnati_enquirer', 'physics_world', 'pressonline',
|
'hindu', 'cincinnati_enquirer', 'physics_world', 'pressonline',
|
||||||
'la_republica', 'physics_today', 'chicago_tribune',
|
'la_republica', 'physics_today', 'chicago_tribune', 'e_novine',
|
||||||
|
'al_jazeera',
|
||||||
)]
|
)]
|
||||||
|
|
||||||
import re, imp, inspect, time, os
|
import re, imp, inspect, time, os
|
||||||
|
50
src/calibre/web/feeds/recipes/recipe_al_jazeera.py
Normal file
50
src/calibre/web/feeds/recipes/recipe_al_jazeera.py
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
|
||||||
|
'''
|
||||||
|
aljazeera.net
|
||||||
|
'''
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class AlJazeera(BasicNewsRecipe):
|
||||||
|
title = 'Al Jazeera in English'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'News from Middle East'
|
||||||
|
publisher = 'Al Jazeera'
|
||||||
|
category = 'news, politics, middle east'
|
||||||
|
simultaneous_downloads = 1
|
||||||
|
delay = 4
|
||||||
|
oldest_article = 1
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
encoding = 'iso-8859-1'
|
||||||
|
remove_javascript = True
|
||||||
|
use_embedded_content = False
|
||||||
|
|
||||||
|
html2lrf_options = [
|
||||||
|
'--comment', description
|
||||||
|
, '--category', category
|
||||||
|
, '--publisher', publisher
|
||||||
|
, '--ignore-tables'
|
||||||
|
]
|
||||||
|
|
||||||
|
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\nlinearize_table=True'
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':'ctl00_divContent'})]
|
||||||
|
|
||||||
|
remove_tags = [
|
||||||
|
dict(name=['object','link'])
|
||||||
|
,dict(name='td', attrs={'class':['MostActiveDescHeader','MostActiveDescBody']})
|
||||||
|
]
|
||||||
|
|
||||||
|
feeds = [(u'AL JAZEERA ENGLISH (AJE)', u'http://english.aljazeera.net/Services/Rss/?PostingId=2007731105943979989' )]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
for item in soup.findAll(face=True):
|
||||||
|
del item['face']
|
||||||
|
return soup
|
||||||
|
|
58
src/calibre/web/feeds/recipes/recipe_e_novine.py
Normal file
58
src/calibre/web/feeds/recipes/recipe_e_novine.py
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
__license__ = 'GPL v3'
|
||||||
|
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
|
|
||||||
|
'''
|
||||||
|
e-novine.com
|
||||||
|
'''
|
||||||
|
|
||||||
|
import re
|
||||||
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
class E_novine(BasicNewsRecipe):
|
||||||
|
title = 'E-Novine'
|
||||||
|
__author__ = 'Darko Miletic'
|
||||||
|
description = 'News from Serbia'
|
||||||
|
publisher = 'E-novine'
|
||||||
|
category = 'news, politics, Balcans'
|
||||||
|
oldest_article = 1
|
||||||
|
max_articles_per_feed = 100
|
||||||
|
no_stylesheets = True
|
||||||
|
encoding = 'cp1250'
|
||||||
|
cover_url = 'http://www.e-novine.com/slike/slike_3/r1/g2008/m03/y3165525326702598.jpg'
|
||||||
|
remove_javascript = True
|
||||||
|
use_embedded_content = False
|
||||||
|
language = _('Serbian')
|
||||||
|
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{text-align: justify; font-family: serif1, serif} .article_description{font-family: sans1, sans-serif}'
|
||||||
|
|
||||||
|
html2lrf_options = [
|
||||||
|
'--comment', description
|
||||||
|
, '--category', category
|
||||||
|
, '--publisher', publisher
|
||||||
|
]
|
||||||
|
|
||||||
|
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"\noverride_css=" p {text-indent: 0em; margin-top: 0em; margin-bottom: 0.5em} img {margin-top: 0em; margin-bottom: 0.4em}"'
|
||||||
|
|
||||||
|
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'id':['css_47_0_2844H']})]
|
||||||
|
|
||||||
|
remove_tags = [dict(name=['object','link','embed','iframe'])]
|
||||||
|
|
||||||
|
feeds = [(u'Sve vesti', u'http://www.e-novine.com/rss/e-novine.xml' )]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
soup.html['xml:lang'] = 'sr-Latn-ME'
|
||||||
|
soup.html['lang'] = 'sr-Latn-ME'
|
||||||
|
mtag = '<meta http-equiv="Content-Language" content="sr-Latn-ME"/>'
|
||||||
|
soup.head.insert(0,mtag)
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
ftag = soup.find('div', attrs={'id':'css_47_0_2844H'})
|
||||||
|
if ftag:
|
||||||
|
it = ftag.div
|
||||||
|
it.extract()
|
||||||
|
ftag.div.extract()
|
||||||
|
ftag.insert(0,it)
|
||||||
|
return soup
|
@ -676,7 +676,7 @@ class stage3(OptionlessCommand):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
OptionlessCommand.run(self)
|
OptionlessCommand.run(self)
|
||||||
self.misc()
|
self.misc()
|
||||||
|
|
||||||
class stage2(OptionlessCommand):
|
class stage2(OptionlessCommand):
|
||||||
description = 'Stage 2 of the build process'
|
description = 'Stage 2 of the build process'
|
||||||
@ -705,4 +705,4 @@ class upload(OptionlessCommand):
|
|||||||
('stage1', None),
|
('stage1', None),
|
||||||
('stage2', None),
|
('stage2', None),
|
||||||
('stage3', None)
|
('stage3', None)
|
||||||
]
|
]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user