mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-04-29 01:53:45 +02:00
53 lines
3.5 KiB
Text
53 lines
3.5 KiB
Text
from calibre.web.feeds.news import BasicNewsRecipe
|
|
import re
|
|
from calibre.ebooks.BeautifulSoup import BeautifulSoup
|
|
class FilmWebPl(BasicNewsRecipe):
|
|
title = u'FilmWeb'
|
|
__author__ = 'fenuks'
|
|
description = 'FilmWeb - biggest polish movie site'
|
|
cover_url = 'http://userlogos.org/files/logos/crudus/filmweb.png'
|
|
category = 'movies'
|
|
language = 'pl'
|
|
index='http://www.filmweb.pl'
|
|
oldest_article = 8
|
|
max_articles_per_feed = 100
|
|
no_stylesheets= True
|
|
remove_empty_feeds=True
|
|
ignore_duplicate_articles = {'title', 'url'}
|
|
preprocess_regexps = [(re.compile(u'\(kliknij\,\ aby powiększyć\)', re.IGNORECASE), lambda m: ''), ]#(re.compile(ur' | ', re.IGNORECASE), lambda m: '')]
|
|
extra_css = '.hdrBig {font-size:22px;} ul {list-style-type:none; padding: 0; margin: 0;}'
|
|
remove_tags= [dict(name='div', attrs={'class':['recommendOthers']}), dict(name='ul', attrs={'class':'fontSizeSet'}), dict(attrs={'class':'userSurname anno'})]
|
|
keep_only_tags= [dict(name='h1', attrs={'class':['hdrBig', 'hdrEntity']}), dict(name='div', attrs={'class':['newsInfo', 'newsInfoSmall', 'reviewContent description']})]
|
|
feeds = [(u'News / Filmy w produkcji', 'http://www.filmweb.pl/feed/news/category/filminproduction'),
|
|
(u'News / Festiwale, nagrody i przeglądy', u'http://www.filmweb.pl/feed/news/category/festival'),
|
|
(u'News / Seriale', u'http://www.filmweb.pl/feed/news/category/serials'),
|
|
(u'News / Box office', u'http://www.filmweb.pl/feed/news/category/boxoffice'),
|
|
(u'News / Multimedia', u'http://www.filmweb.pl/feed/news/category/multimedia'),
|
|
(u'News / Dystrybucja dvd / blu-ray', u'http://www.filmweb.pl/feed/news/category/video'),
|
|
(u'News / Dystrybucja kinowa', u'http://www.filmweb.pl/feed/news/category/cinema'),
|
|
(u'News / off', u'http://www.filmweb.pl/feed/news/category/off'),
|
|
(u'News / Gry wideo', u'http://www.filmweb.pl/feed/news/category/game'),
|
|
(u'News / Organizacje branżowe', u'http://www.filmweb.pl/feed/news/category/organizations'),
|
|
(u'News / Internet', u'http://www.filmweb.pl/feed/news/category/internet'),
|
|
(u'News / Różne', u'http://www.filmweb.pl/feed/news/category/other'),
|
|
(u'News / Kino polskie', u'http://www.filmweb.pl/feed/news/category/polish.cinema'),
|
|
(u'News / Telewizja', u'http://www.filmweb.pl/feed/news/category/tv'),
|
|
(u'Recenzje redakcji', u'http://www.filmweb.pl/feed/reviews/latest'),
|
|
(u'Recenzje użytkowników', u'http://www.filmweb.pl/feed/user-reviews/latest')
|
|
]
|
|
|
|
def skip_ad_pages(self, soup):
|
|
skip_tag = soup.find('a', attrs={'class':'welcomeScreenButton'})
|
|
if skip_tag is not None:
|
|
return self.index_to_soup(skip_tag['href'], raw=True)
|
|
|
|
def preprocess_html(self, soup):
|
|
for a in soup('a'):
|
|
if a.has_key('href') and 'http://' not in a['href'] and 'https://' not in a['href']:
|
|
a['href']=self.index + a['href']
|
|
for i in soup.findAll('a', attrs={'class':'fn'}):
|
|
i.insert(len(i), BeautifulSoup('<br />'))
|
|
for i in soup.findAll('sup'):
|
|
if not i.string or i.string.startswith('(kliknij'):
|
|
i.extract()
|
|
return soup
|