mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update Fronda and Gosc Niedzelny
This commit is contained in:
commit
e15eec8d93
@ -37,7 +37,7 @@ nbproject/
|
|||||||
calibre_plugins/
|
calibre_plugins/
|
||||||
recipes/.git
|
recipes/.git
|
||||||
recipes/.gitignore
|
recipes/.gitignore
|
||||||
recipes/README
|
recipes/README.md
|
||||||
recipes/katalog_egazeciarz.recipe
|
recipes/katalog_egazeciarz.recipe
|
||||||
recipes/tv_axnscifi.recipe
|
recipes/tv_axnscifi.recipe
|
||||||
recipes/tv_comedycentral.recipe
|
recipes/tv_comedycentral.recipe
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = u'2010-2012, Tomasz Dlugosz <tomek3d@gmail.com>'
|
__copyright__ = u'2010-2013, Tomasz Dlugosz <tomek3d@gmail.com>'
|
||||||
'''
|
'''
|
||||||
fronda.pl
|
fronda.pl
|
||||||
'''
|
'''
|
||||||
@ -68,7 +68,8 @@ class Fronda(BasicNewsRecipe):
|
|||||||
article_url = 'http://www.fronda.pl' + article_a['href']
|
article_url = 'http://www.fronda.pl' + article_a['href']
|
||||||
article_title = self.tag_to_string(article_a)
|
article_title = self.tag_to_string(article_a)
|
||||||
articles[genName].append( { 'title' : article_title, 'url' : article_url, 'date' : article_date })
|
articles[genName].append( { 'title' : article_title, 'url' : article_url, 'date' : article_date })
|
||||||
feeds.append((genName, articles[genName]))
|
if articles[genName]:
|
||||||
|
feeds.append((genName, articles[genName]))
|
||||||
return feeds
|
return feeds
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
@ -82,8 +83,10 @@ class Fronda(BasicNewsRecipe):
|
|||||||
dict(name='h3', attrs={'class':'block-header article comments'}),
|
dict(name='h3', attrs={'class':'block-header article comments'}),
|
||||||
dict(name='ul', attrs={'class':'comment-list'}),
|
dict(name='ul', attrs={'class':'comment-list'}),
|
||||||
dict(name='ul', attrs={'class':'category'}),
|
dict(name='ul', attrs={'class':'category'}),
|
||||||
|
dict(name='ul', attrs={'class':'tag-list'}),
|
||||||
dict(name='p', attrs={'id':'comments-disclaimer'}),
|
dict(name='p', attrs={'id':'comments-disclaimer'}),
|
||||||
dict(name='div', attrs={'style':'text-align: left; margin-bottom: 15px;'}),
|
dict(name='div', attrs={'style':'text-align: left; margin-bottom: 15px;'}),
|
||||||
dict(name='div', attrs={'style':'text-align: left; margin-top: 15px;'}),
|
dict(name='div', attrs={'style':'text-align: left; margin-top: 15px; margin-bottom: 30px;'}),
|
||||||
|
dict(name='div', attrs={'class':'related-articles content'}),
|
||||||
dict(name='div', attrs={'id':'comment-form'})
|
dict(name='div', attrs={'id':'comment-form'})
|
||||||
]
|
]
|
||||||
|
@ -2,7 +2,8 @@
|
|||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com'
|
__copyright__ = '2011, Piotr Kontek, piotr.kontek@gmail.com \
|
||||||
|
2013, Tomasz Długosz, tomek3d@gmail.com'
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
@ -12,9 +13,9 @@ import re
|
|||||||
class GN(BasicNewsRecipe):
|
class GN(BasicNewsRecipe):
|
||||||
EDITION = 0
|
EDITION = 0
|
||||||
|
|
||||||
__author__ = 'Piotr Kontek'
|
__author__ = 'Piotr Kontek, Tomasz Długosz'
|
||||||
title = u'Gość niedzielny'
|
title = u'Gość Niedzielny'
|
||||||
description = 'Weekly magazine'
|
description = 'Ogólnopolski tygodnik katolicki'
|
||||||
encoding = 'utf-8'
|
encoding = 'utf-8'
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
language = 'pl'
|
language = 'pl'
|
||||||
@ -38,17 +39,25 @@ class GN(BasicNewsRecipe):
|
|||||||
first = True
|
first = True
|
||||||
for p in main_section.findAll('p', attrs={'class':None}, recursive=False):
|
for p in main_section.findAll('p', attrs={'class':None}, recursive=False):
|
||||||
if first and p.find('img') != None:
|
if first and p.find('img') != None:
|
||||||
article = article + '<p>'
|
article += '<p>'
|
||||||
article = article + str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/')
|
article += str(p.find('img')).replace('src="/files/','src="http://www.gosc.pl/files/')
|
||||||
article = article + '<font size="-2">'
|
article += '<font size="-2">'
|
||||||
for s in p.findAll('span'):
|
for s in p.findAll('span'):
|
||||||
article = article + self.tag_to_string(s)
|
article += self.tag_to_string(s)
|
||||||
article = article + '</font></p>'
|
article += '</font></p>'
|
||||||
else:
|
else:
|
||||||
article = article + str(p).replace('src="/files/','src="http://www.gosc.pl/files/')
|
article += str(p).replace('src="/files/','src="http://www.gosc.pl/files/')
|
||||||
first = False
|
first = False
|
||||||
|
limiter = main_section.find('p', attrs={'class' : 'limiter'})
|
||||||
|
if limiter:
|
||||||
|
article += str(limiter)
|
||||||
|
|
||||||
html = unicode(title) + unicode(authors) + unicode(article)
|
html = unicode(title)
|
||||||
|
#sometimes authors are not filled in:
|
||||||
|
if authors:
|
||||||
|
html += unicode(authors) + unicode(article)
|
||||||
|
else:
|
||||||
|
html += unicode(article)
|
||||||
|
|
||||||
self.temp_files.append(PersistentTemporaryFile('_temparse.html'))
|
self.temp_files.append(PersistentTemporaryFile('_temparse.html'))
|
||||||
self.temp_files[-1].write(html)
|
self.temp_files[-1].write(html)
|
||||||
@ -65,7 +74,8 @@ class GN(BasicNewsRecipe):
|
|||||||
if img != None:
|
if img != None:
|
||||||
a = img.parent
|
a = img.parent
|
||||||
self.EDITION = a['href']
|
self.EDITION = a['href']
|
||||||
self.title = img['alt']
|
#this was preventing kindles from moving old issues to 'Back Issues' category:
|
||||||
|
#self.title = img['alt']
|
||||||
self.cover_url = 'http://www.gosc.pl' + img['src']
|
self.cover_url = 'http://www.gosc.pl' + img['src']
|
||||||
if year != date.today().year or not first:
|
if year != date.today().year or not first:
|
||||||
break
|
break
|
||||||
|
Loading…
x
Reference in New Issue
Block a user