| 1 |
""" |
| 2 |
Fetch Magyar Nemzet |
| 3 |
""" |
| 4 |
|
| 5 |
import re |
| 6 |
|
| 7 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class mn(BasicNewsRecipe): |
| 11 |
title = 'Magyar Nemzet' |
| 12 |
description = '' |
| 13 |
__author__ = 'bubak' |
| 14 |
use_embedded_content = False |
| 15 |
oldest_article = 2 |
| 16 |
max_articles_per_feed = 40 |
| 17 |
no_stylesheets = True |
| 18 |
language = 'hu' |
| 19 |
simultaneous_downloads = 5 |
| 20 |
|
| 21 |
remove_javascript = True |
| 22 |
cover_url = 'https://magyarnemzet.hu/assets/images/logo-mno-dark.svg' |
| 23 |
|
| 24 |
feeds = [('MNO hĂrek2', 'https://magyarnemzet.hu/publicapi/hu/rss/magyar_nemzet/articles')] |
| 25 |
|
| 26 |
extra_css = ''' |
| 27 |
''' |
| 28 |
|
| 29 |
def preprocess_html(self, soup): |
| 30 |
h2 = soup.find('h2') |
| 31 |
h2.name = 'badH2' |
| 32 |
return soup |
| 33 |
|
| 34 |
preprocess_regexps = [(re.compile(r'<a\s[^>]*>(.*?)</a>', re.DOTALL | re.IGNORECASE), lambda match: match.group(1))] |
| 35 |
|
| 36 |
remove_attributes = [] |
| 37 |
remove_tags_before = dict(name='h3', attrs={'class': ['cikkcim']}) |
| 38 |
remove_tags_after = dict(name='mno-promo-block') |
| 39 |
remove_tags = [ |
| 40 |
dict(name='div', attrs={'class': ['adbox ad_cikk_kozepre']}), |
| 41 |
dict(name='div', attrs={'class': ['cikk_share_box clr', 'sidebar', 'breaking']}), |
| 42 |
dict(name='div', attrs={'class': ['cikk-cimkek', 'colwrp', 'article-cikkboxes clearfix']}), |
| 43 |
dict(name='div', attrs={'class': ['author', 'article-data', 'info-line', 'dossier-link-wrapper']}), |
| 44 |
dict(name='div', attrs={'id': ['menu', 'article-right-col', 'header']}), |
| 45 |
dict(name='header'), |
| 46 |
dict(name='app-breadcrumb'), |
| 47 |
dict(name='mno-tag-list'), |
| 48 |
dict(name='figcaption'), |
| 49 |
dict(name='app-comment-section'), |
| 50 |
dict(name='div', attrs={'class': ['cikk_video_box box clr', 'cikkblock']}), |
| 51 |
dict(name='article', attrs={'class': ['article-recommender']}), |
| 52 |
dict(name='a', attrs={'href': ['http://www.mno.hu/sorolo', '/rovat/keresztrejtveny']}), |
| 53 |
dict(name='app-recommendation-block'), |
| 54 |
dict(name='mno-external-recommendation-block'), |
| 55 |
dict(name='mno-opinion-newsletter-box'), |
| 56 |
dict(name='mno-promo-block'), |
| 57 |
dict(name='mno-tag-list'), |
| 58 |
dict(name='div', attrs={'class': ['print']}), |
| 59 |
] |