| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
|
| 4 |
__license__ = 'GPL v3' |
| 5 |
__copyright__ = '2010-2013, Darko Miletic <darko.miletic at gmail.com>' |
| 6 |
''' |
| 7 |
www.kommersant.ru |
| 8 |
''' |
| 9 |
|
| 10 |
from calibre.web.feeds.news import BasicNewsRecipe, classes |
| 11 |
|
| 12 |
|
| 13 |
class Kommersant_ru(BasicNewsRecipe): |
| 14 |
title = 'Kommersant' |
| 15 |
__author__ = 'Darko Miletic (with fixes by bugmen00t)' |
| 16 |
description = 'News from Russia' |
| 17 |
publisher = 'Kommersant' |
| 18 |
category = 'news, politics, Russia' |
| 19 |
oldest_article = 7 |
| 20 |
max_articles_per_feed = 50 |
| 21 |
no_stylesheets = True |
| 22 |
use_embedded_content = False |
| 23 |
language = 'ru' |
| 24 |
publication_type = 'newspaper' |
| 25 |
cover_url = 'https://iv.kommersant.ru/ContentFlex/images/logo.png' |
| 26 |
|
| 27 |
remove_tags_before = dict(name='header', attrs={'class': 'doc_header'}) |
| 28 |
|
| 29 |
remove_tags_after = dict(name='div', attrs={'class': 'doc__text document_authors'}) |
| 30 |
|
| 31 |
remove_tags = [ |
| 32 |
dict(name='ul', attrs={'class': 'crumbs'}), |
| 33 |
dict(name='div', attrs={'class': 'hide_desktop'}), |
| 34 |
dict(name='div', attrs={'class': 'incut incut--right'}), |
| 35 |
dict(name='div', attrs={'class': 'incut incut--left'}), |
| 36 |
dict(name='div', attrs={'class': 'incut incut--center'}), |
| 37 |
dict(name='div', attrs={'class': 'ba'}), |
| 38 |
dict(name='div', attrs={'id': 'lenta'}), |
| 39 |
dict(name='div', attrs={'class': 'layout basement_news__body'}), |
| 40 |
dict(name='footer', attrs={'class': 'footer'}), |
| 41 |
dict(name='section', attrs={'class': 'potd'}), |
| 42 |
dict(name='footer', attrs={'class': 'doc_footer'}), |
| 43 |
classes('ui-modal__hide'), |
| 44 |
dict(name='div', attrs={'class': 'adv_interscroll hide_desktop'}), |
| 45 |
dict(name=['button', 'source']), |
| 46 |
] |
| 47 |
|
| 48 |
def preprocess_html(self, soup): |
| 49 |
for tag in soup.findAll(attrs={'data-lazyimage-src': True}): |
| 50 |
tag['src'] = tag['data-lazyimage-src'] |
| 51 |
return soup |
| 52 |
|
| 53 |
feeds = [ |
| 54 |
('\u0413\u043b\u0430\u0432\u043d\u043e\u0435', 'https://www.kommersant.ru/rss/main.xml'), |
| 55 |
('\u0413\u0430\u0437\u0435\u0442\u0430 "\u041a\u043e\u043c\u043c\u0435\u0440\u0441\u0430\u043d\u0442"', 'https://www.kommersant.ru/rss/daily.xml'), |
| 56 |
('\u041b\u0435\u043d\u0442\u0430 \u043d\u043e\u0432\u043e\u0441\u0442\u0435\u0439', 'https://www.kommersant.ru/RSS/news.xml'), |
| 57 |
('\u041c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b \u0441 \u0441\u0430\u0439\u0442\u0430', 'https://www.kommersant.ru/RSS/corp.xml'), |
| 58 |
('\u0420\u0430\u0434\u0438\u043e \u041a\u043e\u043c\u043c\u0435\u0440\u0441\u0430\u043d\u0442\u044a-FM', 'https://www.kommersant.ru/RSS/radio.xml'), |
| 59 |
( |
| 60 |
'\u0422\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f', |
| 61 |
'https://www.kommersant.ru/RSS/tema.xml', |
| 62 |
), |
| 63 |
('\u0416\u0443\u0440\u043d\u0430\u043b \u00ab\u041e\u0413\u041e\u041d\u0401\u041a\u00bb', 'https://www.kommersant.ru/RSS/ogoniok.xml'), |
| 64 |
( |
| 65 |
'\u0416\u0443\u0440\u043d\u0430\u043b \u00ab\u041a\u043e\u043c\u043c\u0435\u0440\u0441\u0430\u043d\u0442\u044a WEEKEND\u00bb', |
| 66 |
'https://www.kommersant.ru/RSS/weekend.xml', |
| 67 |
), |
| 68 |
('Журнал «Коммерсантъ АВТОПИЛОТ»', 'https://www.kommersant.ru/RSS/auto.xml'), |
| 69 |
('\u041f\u043e\u043b\u0438\u0442\u0438\u043a\u0430', 'https://www.kommersant.ru/rss/section-politics.xml'), |
| 70 |
('\u042d\u043a\u043e\u043d\u043e\u043c\u0438\u043a\u0430', 'https://www.kommersant.ru/RSS/section-economics.xml'), |
| 71 |
('\u0411\u0438\u0437\u043d\u0435\u0441', 'https://www.kommersant.ru/rss/section-business.xml'), |
| 72 |
('\u0412 \u043c\u0438\u0440\u0435', 'https://www.kommersant.ru/rss/section-world.xml'), |
| 73 |
('\u041f\u0440\u043e\u0438\u0441\u0448\u0435\u0441\u0442\u0432\u0438\u044f', 'https://www.kommersant.ru/rss/section-accidents.xml'), |
| 74 |
('\u041e\u0431\u0449\u0435\u0441\u0442\u0432\u043e', 'https://www.kommersant.ru/rss/section-society.xml'), |
| 75 |
('\u041a\u0443\u043b\u044c\u0442\u0443\u0440\u0430', 'https://www.kommersant.ru/rss/section-culture.xml'), |
| 76 |
('\u0421\u043f\u043e\u0440\u0442', 'https://www.kommersant.ru/rss/section-sport.xml'), |
| 77 |
('Hi-Tech', 'https://www.kommersant.ru/RSS/section-hitech.xml'), |
| 78 |
('\u0410\u0432\u0442\u043e', 'https://www.kommersant.ru/RSS/Autopilot_on.xml'), |
| 79 |
('\u0421\u0442\u0438\u043b\u044c', 'https://www.kommersant.ru/RSS/section-style.xml'), |
| 80 |
('\u0421\u0430\u043d\u043a\u0442-\u041f\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433', 'https://www.kommersant.ru/rss/regions/piter_all.xml'), |
| 81 |
('\u0412\u043e\u0440\u043e\u043d\u0435\u0436', 'https://www.kommersant.ru/rss/regions/vrn_all.xml'), |
| 82 |
('\u0415\u043a\u0430\u0442\u0435\u0440\u0438\u043d\u0431\u0443\u0440\u0433', 'https://www.kommersant.ru/rss/regions/ekaterinburg_all.xml'), |
| 83 |
('\u0418\u0436\u0435\u0432\u0441\u043a', 'https://www.kommersant.ru/rss/regions/izhevsk_all.xml'), |
| 84 |
('\u041a\u0430\u0437\u0430\u043d\u044c', 'https://www.kommersant.ru/rss/regions/kazan_all.xml'), |
| 85 |
('\u041a\u0440\u0430\u0441\u043d\u043e\u0434\u0430\u0440', 'https://www.kommersant.ru/rss/regions/krasnodar_all.xml'), |
| 86 |
('\u041a\u0440\u0430\u0441\u043d\u043e\u044f\u0440\u0441\u043a', 'https://www.kommersant.ru/rss/regions/krasnoyarsk_all.xml'), |
| 87 |
('\u041d\u0438\u0436\u043d\u0438\u0439 \u041d\u043e\u0432\u0433\u043e\u0440\u043e\u0434', 'https://www.kommersant.ru/rss/regions/nnov_all.xml'), |
| 88 |
('\u041d\u043e\u0432\u043e\u0441\u0438\u0431\u0438\u0440\u0441\u043a', 'https://www.kommersant.ru/rss/regions/novosibirsk_all.xml'), |
| 89 |
('\u041f\u0435\u0440\u043c\u044c', 'https://www.kommersant.ru/rss/regions/perm_all.xml'), |
| 90 |
('\u0420\u043e\u0441\u0442\u043e\u0432-\u043d\u0430-\u0414\u043e\u043d\u0443', 'https://www.kommersant.ru/rss/regions/rostov_all.xml'), |
| 91 |
('\u0421\u0430\u043c\u0430\u0440\u0430', 'https://www.kommersant.ru/rss/regions/samara_all.xml'), |
| 92 |
('\u0421\u0430\u0440\u0430\u0442\u043e\u0432', 'https://www.kommersant.ru/rss/regions/saratov_all.xml'), |
| 93 |
('\u0423\u0444\u0430', 'https://www.kommersant.ru/rss/regions/ufa_all.xml'), |
| 94 |
('\u0427\u0435\u043b\u044f\u0431\u0438\u043d\u0441\u043a', 'https://www.kommersant.ru/rss/regions/chelyabinsk_all.xml'), |
| 95 |
] |