| 1 |
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai |
| 2 |
from __future__ import unicode_literals |
| 3 |
|
| 4 |
''' |
| 5 |
Fetch Népszabadság |
| 6 |
''' |
| 7 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class nepszabadsag(BasicNewsRecipe): |
| 11 |
title = 'N\u00e9pszabads\u00e1g' |
| 12 |
description = '' |
| 13 |
__author__ = 'bubak' |
| 14 |
use_embedded_content = False |
| 15 |
timefmt = ' [%d %b %Y]' |
| 16 |
oldest_article = 2 |
| 17 |
max_articles_per_feed = 20 |
| 18 |
no_stylesheets = True |
| 19 |
language = 'hu' |
| 20 |
simultaneous_downloads = 5 |
| 21 |
|
| 22 |
remove_javascript = True |
| 23 |
cover_url = 'http://nol.hu/_design/image/logo_nol_live.jpg' |
| 24 |
|
| 25 |
feeds = [('Belföld', 'http://nol.hu/feed/belfold.rss')] |
| 26 |
|
| 27 |
remove_attributes = [] |
| 28 |
remove_tags_before = dict(name='div', attrs={'class': ['d-source']}) |
| 29 |
remove_tags_after = dict(name='div', attrs={'class': ['tags']}) |
| 30 |
remove_tags = [dict(name='div', attrs={'class': ['h']}), dict(name='tfoot')] |
| 31 |
|
| 32 |
keep_only_tags = [dict(name='table', attrs={'class': 'article-box'})] |
| 33 |
|
| 34 |
# NS sends an ad page sometimes but not frequently enough, TBD |
| 35 |
def AAskip_ad_pages(self, soup): |
| 36 |
if 'advertisement' in soup.find('title').string.lower(): |
| 37 |
href = soup.find('a').get('href') |
| 38 |
self.log.debug('Skipping to: ' + href) |
| 39 |
new = self.browser.open(href).read().decode('utf-8', 'ignore') |
| 40 |
# ipython(locals()) |
| 41 |
self.log.debug('Finished: ' + href) |
| 42 |
return new |
| 43 |
else: |
| 44 |
return None |