mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Sarajevo-x by Darko Miletic
This commit is contained in:
parent
42d335a5c2
commit
ce67fe9797
BIN
resources/images/news/sarajevo_x.png
Normal file
BIN
resources/images/news/sarajevo_x.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 542 B |
66
resources/recipes/sarajevo_x.recipe
Normal file
66
resources/recipes/sarajevo_x.recipe
Normal file
@ -0,0 +1,66 @@
|
||||
__license__ = 'GPL v3'
|
||||
__copyright__ = '2010, Darko Miletic <darko.miletic at gmail.com>'
|
||||
|
||||
'''
|
||||
sarajevo-x.com
|
||||
'''
|
||||
|
||||
import re
|
||||
from calibre.web.feeds.recipes import BasicNewsRecipe
|
||||
from calibre.ebooks.BeautifulSoup import Tag, NavigableString
|
||||
|
||||
class SarajevoX(BasicNewsRecipe):
|
||||
title = 'Sarajevo-x.com'
|
||||
__author__ = 'Darko Miletic'
|
||||
description = 'Sarajevo-x.com - najposjeceniji bosanskohercegovacki internet portal'
|
||||
publisher = 'InterSoft d.o.o.'
|
||||
category = 'news, politics, Bosnia and Herzegovina,Sarajevo-x.com, internet, portal, vijesti, bosna i hercegovina, sarajevo'
|
||||
oldest_article = 2
|
||||
delay = 1
|
||||
max_articles_per_feed = 100
|
||||
no_stylesheets = True
|
||||
encoding = 'cp1250'
|
||||
use_embedded_content = False
|
||||
language = 'bs'
|
||||
extra_css = ' @font-face {font-family: "sans1";src:url(res:///opt/sony/ebook/FONT/tt0003m_.ttf)} body{font-family: Arial,Verdana,Helvetica,sans1,sans-serif} .article_description{font-family: sans1, sans-serif} div#fotka{display: block} img{margin-bottom: 0.5em} '
|
||||
|
||||
conversion_options = {
|
||||
'comment' : description
|
||||
, 'tags' : category
|
||||
, 'publisher' : publisher
|
||||
, 'language' : language
|
||||
}
|
||||
|
||||
preprocess_regexps = [(re.compile(u'\u0110'), lambda match: u'\u00D0')]
|
||||
|
||||
keep_only_tags = [dict(name='div', attrs={'class':'content-bg'})]
|
||||
remove_tags_after = dict(name='div',attrs={'class':'izvor'})
|
||||
remove_tags = [dict(name=['object','link','base','table'])]
|
||||
remove_attributes = ['height','width','alt','border']
|
||||
|
||||
feeds = [
|
||||
(u'BIH' , u'http://www.sarajevo-x.com/rss/bih' )
|
||||
,(u'Svijet' , u'http://www.sarajevo-x.com/rss/svijet' )
|
||||
,(u'Biznis' , u'http://www.sarajevo-x.com/rss/biznis' )
|
||||
,(u'Sport' , u'http://www.sarajevo-x.com/rss/sport' )
|
||||
,(u'Showtime' , u'http://www.sarajevo-x.com/rss/showtime' )
|
||||
,(u'Scitech' , u'http://www.sarajevo-x.com/rss/scitech' )
|
||||
,(u'Lifestyle' , u'http://www.sarajevo-x.com/rss/lifestyle' )
|
||||
,(u'Kultura' , u'http://www.sarajevo-x.com/rss/kultura' )
|
||||
,(u'Zanimljivosti', u'http://www.sarajevo-x.com/rss/zanimljivosti')
|
||||
]
|
||||
|
||||
def preprocess_html(self, soup):
|
||||
dtag = soup.find('div',attrs={'id':'fotka'})
|
||||
if dtag:
|
||||
sp = soup.find('div',attrs={'id':'opisslike'})
|
||||
img = soup.find('img')
|
||||
if sp:
|
||||
sp
|
||||
else:
|
||||
mtag = Tag(soup,'div',[("id","opisslike"),("class","opscitech")])
|
||||
mopis = NavigableString("Opis")
|
||||
mtag.insert(0,mopis)
|
||||
img.append(mtag)
|
||||
return soup
|
||||
|
Loading…
x
Reference in New Issue
Block a user