| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
|
| 4 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 5 |
|
| 6 |
|
| 7 |
class Mel(BasicNewsRecipe): |
| 8 |
title = '\u041c\u0435\u043b' |
| 9 |
__author__ = 'bugmen00t' |
| 10 |
description = '\u041c\u0435\u0434\u0438\u0430 \u043f\u0440\u043e \u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u0435 \u0438 \u0432\u043e\u0441\u043f\u0438\u0442\u0430\u043d\u0438\u0435 \u0434\u0435\u0442\u0435\u0439' # noqa: E501 |
| 11 |
publisher = '\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442-\u0438\u0437\u0434\u0430\u043d\u0438\u0435 \u00ab\u041c\u0435\u043b\u00bb' |
| 12 |
category = 'blog' |
| 13 |
cover_url = 'https://static.mel.fm/images/project/site/dummyLogo.png' |
| 14 |
language = 'ru' |
| 15 |
no_stylesheets = False |
| 16 |
remove_javascript = False |
| 17 |
auto_cleanup = False |
| 18 |
oldest_article = 7 |
| 19 |
max_articles_per_feed = 50 |
| 20 |
|
| 21 |
remove_tags_before = dict(name='article') |
| 22 |
|
| 23 |
remove_tags_after = dict(name='div', attrs={'class': 'b-pb-article__body'}) |
| 24 |
|
| 25 |
remove_tags = [ |
| 26 |
dict(name='div', attrs={'class': 'b-ad-space__horizontal-centering'}), |
| 27 |
dict(name='div', attrs={'class': 'subscriptionBlock b-pb-publication-body__publication-newsletter-form'}), |
| 28 |
dict(name='div', attrs={'class': 'subscriptionBlock b-pb-article__publication-newsletter-form b-pb-article__publication-newsletter-form-post'}), |
| 29 |
dict(name='div', attrs={'class': 'newsletter-form b-pb-article__publication-newsletter-form'}), |
| 30 |
dict(name='div', attrs={'class': 'bottom-wrapper'}), |
| 31 |
dict(name='div', attrs={'class': 'b-pb-article__right-column b-pb-article__right-column_without-cover b-pb-article__right-column_on-post-page'}), |
| 32 |
dict(name='div', attrs={'class': 'b-pb-article__right-column b-pb-article__right-column_with-cover'}), |
| 33 |
dict(name='div', attrs={'class': 'main-tag'}), |
| 34 |
dict(name='div', attrs={'class': 'main-tag_mobile'}), |
| 35 |
dict(name='div', attrs={'class': 'publication-header__counter'}), |
| 36 |
dict(name='div', attrs={'class': 'smi2-news-container smi2-news-container_desktop smi2-news-container_desktop-news'}), |
| 37 |
dict(name='div', attrs={'class': 'smi2-news-container smi2-news-container_desktop'}), |
| 38 |
dict(name='div', attrs={'class': 'smi2-news-container smi2-news-container_mobile smi2-news-container_mobile-news'}), |
| 39 |
dict(name='div', attrs={'class': 'smi2-news-container smi2-news-container_mobile'}), |
| 40 |
] |
| 41 |
|
| 42 |
feeds = [ |
| 43 |
('\u0412\u0441\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b', 'https://mel.fm/rss/default-all'), |
| 44 |
('\u041d\u043e\u0432\u043e\u0441\u0442\u0438', 'https://mel.fm/rss/default-news'), |
| 45 |
] |
| 46 |
|
| 47 |
def preprocess_html(self, soup): |
| 48 |
for img in soup.findAll('img', attrs={'data-src': True}): |
| 49 |
img['src'] = img['data-src'] |
| 50 |
return soup |