calibre/recipes/fdb_pl.recipe
Kovid Goyal 567040ee1e Perform PEP8 compliance checks on the entire codebase
Some bits of PEP 8 are turned off via setup.cfg
2016-07-29 21:25:17 +05:30

48 lines
1.7 KiB
Plaintext

__license__ = 'GPL v3'
from calibre.web.feeds.news import BasicNewsRecipe
class FDBPl(BasicNewsRecipe):
title = u'Fdb.pl'
__author__ = 'fenuks'
description = u'Wiadomości ze świata filmu, baza danych filmowych, recenzje, zwiastuny, boxoffice.'
category = 'film'
language = 'pl'
extra_css = '.options-left > li {display: inline;} em {display: block;}'
cover_url = 'http://fdb.pl/assets/fdb2/logo.png'
use_embedded_content = False
oldest_article = 7
max_articles_per_feed = 100
no_stylesheets = True
remove_empty_feeds = True
remove_javascript = True
remove_attributes = ['style', 'font']
ignore_duplicate_articles = {'title', 'url'}
keep_only_tags = [dict(attrs={'class': 'news-item news-first'})]
remove_tags = [
dict(attrs={'class': ['dig dig-first', 'ads clearfix', 'comments']})]
feeds = []
def parse_index(self):
feeds = []
feeds.append((u'Wiadomości', self.get_articles(
'http://fdb.pl/wiadomosci?page={0}', 2)))
return feeds
def get_articles(self, url, pages=1):
articles = []
for nr in range(1, pages + 1):
soup = self.index_to_soup(url.format(nr))
for tag in soup.findAll(attrs={'class': 'news-item clearfix'}):
node = tag.find('h2')
title = node.a.string
url = 'http://fdb.pl' + node.a['href']
date = ''
articles.append({'title': title,
'url': url,
'date': date,
'description': ''
})
return articles