mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Update tyzden recipe
Add additional CSS, formatting.
This commit is contained in:
parent
3cd9bf2b04
commit
ded5377495
@ -17,15 +17,15 @@
|
|||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
|
||||||
__copyright__ = ('2014 - 2017 Martin Račák <martin.racak@riseup.net>,'
|
|
||||||
'2011 Miroslav Vasko <zemiak@gmail.com>')
|
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from calibre import strftime
|
from calibre import strftime
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
|
||||||
|
__copyright__ = ('2014 - 2017 Martin Račák <martin.racak@riseup.net>,'
|
||||||
|
'2011 Miroslav Vasko <zemiak@gmail.com>')
|
||||||
|
__license__ = 'GPL-3.0+'
|
||||||
|
|
||||||
|
|
||||||
class Tyzden(BasicNewsRecipe):
|
class Tyzden(BasicNewsRecipe):
|
||||||
title = u'.týždeň'
|
title = u'.týždeň'
|
||||||
@ -40,8 +40,18 @@ class Tyzden(BasicNewsRecipe):
|
|||||||
issue_url = 'http://www.tyzden.sk/casopis/'
|
issue_url = 'http://www.tyzden.sk/casopis/'
|
||||||
|
|
||||||
keep_only_tags = [
|
keep_only_tags = [
|
||||||
dict(name='div', attrs={'class': 'section__content section__content--archive'}),
|
{
|
||||||
dict(name='article', attrs={'class': re.compile(r'\barticle\b')}),
|
'name': 'div',
|
||||||
|
'attrs': {
|
||||||
|
'class': 'section__content section__content--archive'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'name': 'article',
|
||||||
|
'attrs': {
|
||||||
|
'class': re.compile(r'\barticle\b')
|
||||||
|
}
|
||||||
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
extra_css = """.theme-highlight {
|
extra_css = """.theme-highlight {
|
||||||
@ -59,22 +69,25 @@ class Tyzden(BasicNewsRecipe):
|
|||||||
display: inline;
|
display: inline;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article__image-credit {
|
.article__image-credit,
|
||||||
font: 12px "TheSerifSemiLight",arial;
|
.content-photo__image-credit {
|
||||||
|
display: block;
|
||||||
|
font: 12px "TheSerifSemiLight", arial;
|
||||||
text-transform: uppercase;
|
text-transform: uppercase;
|
||||||
}
|
}
|
||||||
|
|
||||||
.article__image-title {
|
.article__image-title,
|
||||||
|
.image-title {
|
||||||
padding-top: 2px;
|
padding-top: 2px;
|
||||||
padding-bottom: 2px;
|
padding-bottom: 2px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
font: 15px "TheSerifBold",arial;
|
font: 15px "TheSerifBold", arial;
|
||||||
border-bottom: 2px solid #bf1f10;
|
border-bottom: 2px solid #bf1f10;
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.teaser__title {
|
.teaser__title {
|
||||||
font: 18px "TheSerifBold",arial;
|
font: 18px "TheSerifBold", arial;
|
||||||
color: #bf1f10;
|
color: #bf1f10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,9 +113,11 @@ class Tyzden(BasicNewsRecipe):
|
|||||||
self.cover_url = cover_img['src']
|
self.cover_url = cover_img['src']
|
||||||
|
|
||||||
feeds = []
|
feeds = []
|
||||||
teasers = soup.findAll('div', {'class': re.compile(r'\bteaser--list\b')})
|
teasers = soup.findAll('div',
|
||||||
|
{'class': re.compile(r'\bteaser--list\b')})
|
||||||
for teaser in teasers:
|
for teaser in teasers:
|
||||||
section = self.tag_to_string(teaser.find('a', 'theme-heading__wrapper'))
|
section = self.tag_to_string(
|
||||||
|
teaser.find('a', 'theme-heading__wrapper'))
|
||||||
article_title = self.tag_to_string(
|
article_title = self.tag_to_string(
|
||||||
teaser.find('h1', {'class': re.compile(r'\bteaser__title\b')}))
|
teaser.find('h1', {'class': re.compile(r'\bteaser__title\b')}))
|
||||||
article_link = teaser.find('a', 'teaser__link--main')
|
article_link = teaser.find('a', 'teaser__link--main')
|
||||||
@ -113,7 +128,7 @@ class Tyzden(BasicNewsRecipe):
|
|||||||
}
|
}
|
||||||
|
|
||||||
if not feeds:
|
if not feeds:
|
||||||
# First cycle iteration.
|
# First iteration.
|
||||||
feeds.append((section, [article]))
|
feeds.append((section, [article]))
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user