# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
import re
from calibre.web.feeds.news import BasicNewsRecipe
class Mlody_technik(BasicNewsRecipe):
title = u'Młody technik'
__author__ = 'fenuks'
description = u'Młody technik'
category = 'science'
language = 'pl'
no_stylesheets = True
extra_css = 'img.alignleft {float: left; margin-right: 5px;}'
preprocess_regexps = [
(re.compile(r"
Podobne
", re.IGNORECASE), lambda m: '')]
oldest_article = 7
max_articles_per_feed = 100
remove_empty_feeds = True
use_embedded_content = False
keep_only_tags = [dict(id='content')]
remove_tags = [dict(attrs={'class': 'st-related-posts'})]
remove_tags_after = dict(attrs={'class': 'entry-content clearfix'})
feeds = [(u'Wszystko', u'http://www.mt.com.pl/feed'),
# (u'MT NEWS 24/7', u'http://www.mt.com.pl/kategoria/mt-newsy-24-7/feed'),
(u'Info zoom', u'http://www.mt.com.pl/kategoria/info-zoom/feed'),
(u'm.technik', u'http://www.mt.com.pl/kategoria/m-technik/feed'),
(u'Szkoła', u'http://www.mt.com.pl/kategoria/szkola-2/feed'),
(u'Na Warsztacie', u'http://www.mt.com.pl/kategoria/na-warsztacie/feed'),
(u'Z pasji do...', u'http://www.mt.com.pl/kategoria/z-pasji-do/feed'),
(u'MT testuje', u'http://www.mt.com.pl/kategoria/mt-testuje/feed')]
def get_cover_url(self):
soup = self.index_to_soup('http://www.mt.com.pl/')
tag = soup.find(attrs={'class': 'xoxo'})
if tag:
self.cover_url = tag.find('img')['src']
return getattr(self, 'cover_url', self.cover_url)