mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
6f1daa27ff
commit
e0af0192b7
@ -1,5 +1,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
||||||
|
|
||||||
class Konflikty(BasicNewsRecipe):
|
class Konflikty(BasicNewsRecipe):
|
||||||
title = u'Konflikty Zbrojne'
|
title = u'Konflikty Zbrojne'
|
||||||
@ -13,11 +14,11 @@ class Konflikty(BasicNewsRecipe):
|
|||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
keep_only_tags=[dict(attrs={'class':['title1', 'image']}), dict(id='body')]
|
keep_only_tags=[dict(attrs={'class':['title1', 'image']}), dict(id='body')]
|
||||||
|
|
||||||
feeds = [(u'Aktualności', u'http://www.konflikty.pl/rss_aktualnosci_10.xml'),
|
feeds = [(u'Aktualności', u'http://www.konflikty.pl/rss_aktualnosci_10.xml'),
|
||||||
(u'Artyku\u0142y', u'http://www.konflikty.pl/rss_artykuly_10.xml'),
|
(u'Artyku\u0142y', u'http://www.konflikty.pl/rss_artykuly_10.xml'),
|
||||||
(u'Historia', u'http://www.konflikty.pl/rss_historia_10.xml'),
|
(u'Historia', u'http://www.konflikty.pl/rss_historia_10.xml'),
|
||||||
(u'Militaria', u'http://www.konflikty.pl/rss_militaria_10.xml'),
|
(u'Militaria', u'http://www.konflikty.pl/rss_militaria_10.xml'),
|
||||||
(u'Relacje', u'http://www.konflikty.pl/rss_relacje_10.xml'),
|
(u'Relacje', u'http://www.konflikty.pl/rss_relacje_10.xml'),
|
||||||
(u'Recenzje', u'http://www.konflikty.pl/rss_recenzje_10.xml'),
|
(u'Recenzje', u'http://www.konflikty.pl/rss_recenzje_10.xml'),
|
||||||
(u'Teksty źródłowe', u'http://www.konflikty.pl/rss_tekstyzrodlowe_10.xml')]
|
(u'Teksty źródłowe', u'http://www.konflikty.pl/rss_tekstyzrodlowe_10.xml')]
|
||||||
|
|
||||||
@ -29,4 +30,4 @@ class Konflikty(BasicNewsRecipe):
|
|||||||
image.name='div'
|
image.name='div'
|
||||||
pos = len(image.contents)
|
pos = len(image.contents)
|
||||||
image.insert(pos, BeautifulSoup('<p style="font-style:italic;">'+image.img['alt']+'</p>'))
|
image.insert(pos, BeautifulSoup('<p style="font-style:italic;">'+image.img['alt']+'</p>'))
|
||||||
return soup
|
return soup
|
||||||
|
@ -78,7 +78,7 @@ class AdvancedUserRecipe1306097511(BasicNewsRecipe):
|
|||||||
div.column-3 module-title {border: 1px solid #aaa}\
|
div.column-3 module-title {border: 1px solid #aaa}\
|
||||||
div.article-box-fact div.subtitle, .article-box-fact.module-title, h2.subtitle {font-weight:bold}\
|
div.article-box-fact div.subtitle, .article-box-fact.module-title, h2.subtitle {font-weight:bold}\
|
||||||
div.article-box-fact div.subtitle, hr.merryhr, .article-box-fact.module-title {color: #24763b}'
|
div.article-box-fact div.subtitle, hr.merryhr, .article-box-fact.module-title {color: #24763b}'
|
||||||
|
|
||||||
|
|
||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'<img[^>]+top-line[^>]+>', re.DOTALL|re.IGNORECASE),
|
(re.compile(r'<img[^>]+top-line[^>]+>', re.DOTALL|re.IGNORECASE),
|
||||||
@ -198,7 +198,6 @@ class MerryProcess(BeautifulSoup):
|
|||||||
if not part in allfacts:
|
if not part in allfacts:
|
||||||
self.myKiller.safeRemovePart(part, True)
|
self.myKiller.safeRemovePart(part, True)
|
||||||
articlefacts = soup.find('div', {'class':'article-box-fact column'})
|
articlefacts = soup.find('div', {'class':'article-box-fact column'})
|
||||||
errorOccured=False
|
|
||||||
if (articlefacts and not articlefacts==None):
|
if (articlefacts and not articlefacts==None):
|
||||||
try:
|
try:
|
||||||
contenttag = soup.find('div', {'class':'article-body'})
|
contenttag = soup.find('div', {'class':'article-body'})
|
||||||
@ -208,10 +207,7 @@ class MerryProcess(BeautifulSoup):
|
|||||||
if foundrighttag == True:
|
if foundrighttag == True:
|
||||||
contenttag.insert(0, allfactsparent)
|
contenttag.insert(0, allfactsparent)
|
||||||
except:
|
except:
|
||||||
errorOccured=True
|
pass
|
||||||
mlog.addTrace()
|
|
||||||
else:
|
|
||||||
errorOccured=True
|
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
def previousNextSibRemover(self, soup, previous=True, soupIsArray=False):
|
def previousNextSibRemover(self, soup, previous=True, soupIsArray=False):
|
||||||
|
@ -119,7 +119,7 @@ class Pocket(BasicNewsRecipe):
|
|||||||
try:
|
try:
|
||||||
from calibre.ebooks import calibre_cover
|
from calibre.ebooks import calibre_cover
|
||||||
title = self.title if isinstance(self.title, unicode) else \
|
title = self.title if isinstance(self.title, unicode) else \
|
||||||
self.title.decode(preferred_encoding, 'replace')
|
self.title.decode('utf-8', 'replace')
|
||||||
date = strftime(self.timefmt)
|
date = strftime(self.timefmt)
|
||||||
time = strftime('[%I:%M %p]')
|
time = strftime('[%I:%M %p]')
|
||||||
img_data = calibre_cover(title, date, time)
|
img_data = calibre_cover(title, date, time)
|
||||||
@ -128,4 +128,4 @@ class Pocket(BasicNewsRecipe):
|
|||||||
except:
|
except:
|
||||||
self.log.exception('Failed to generate default cover')
|
self.log.exception('Failed to generate default cover')
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user