#!/usr/bin/env python # vim:fileencoding=utf-8 from calibre.web.feeds.news import BasicNewsRecipe class Habr(BasicNewsRecipe): title = '\u0425\u0430\u0431\u0440' __author__ = 'bugmen00t' description = '\u041d\u0430 \u200b\u0425\u0430\u0431\u0440\u0435 \u200b\u0434\u0443\u043c\u0430\u044e\u0449\u0438\u0435 \u200b\u043b\u044e\u0434\u0438 \u200b\u0434\u0435\u043b\u044f\u0442\u0441\u044f \u200b\u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c \u200b\u200b\u043e\u043f\u044b\u0442\u043e\u043c. \u200b\u200b\u0417\u0434\u0435\u0441\u044c \u0431\u0443\u0434\u0435\u0442 \u200b\u200b\u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u200b\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u200b\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430\u043c \u200b\u0438 \u0436\u0443\u0440\u043d\u0430\u043b\u0438\u0441\u0442\u0430\u043c, \u200b\u200b\u0430\u0434\u043c\u0438\u043d\u0430\u043c \u200b\u0438 \u0440\u0435\u043a\u043b\u0430\u043c\u0449\u0438\u043a\u0430\u043c, \u200b\u0430\u043d\u0430\u043b\u0438\u0442\u0438\u043a\u0430\u043c \u200b\u0438 \u0434\u0438\u0437\u0430\u0439\u043d\u0435\u0440\u0430\u043c, \u200b\u043c\u0435\u043d\u0435\u0434\u0436\u0435\u0440\u0430\u043c \u200b\u0432\u044b\u0441\u0448\u0435\u0433\u043e \u200b\u0438 \u0441\u0440\u0435\u0434\u043d\u0435\u0433\u043e \u200b\u0437\u0432\u0435\u043d\u0430, \u200b\u0432\u043b\u0430\u0434\u0435\u043b\u044c\u0446\u0430\u043c \u200b\u043a\u0440\u0443\u043f\u043d\u044b\u0445 \u200b\u043a\u043e\u043c\u043f\u0430\u043d\u0438\u0439 \u200b\u0438 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u200b\u0444\u0438\u0440\u043c, \u200b\u0430 \u0442\u0430\u043a\u0436\u0435 \u200b\u0432\u0441\u0435\u043c \u200b\u0442\u0435\u043c, \u200b\u0434\u043b\u044f \u043a\u043e\u0433\u043e \u200bIT \u2014 \u200b\u044d\u0442\u043e \u043d\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u200b\u0434\u0432\u0435 \u0431\u0443\u043a\u0432\u044b \u200b\u0430\u043b\u0444\u0430\u0432\u0438\u0442\u0430.' # noqa: E501 publisher = 'Habr Blockchain Publishing LTD' category = 'blog' cover_url = 'https://habr.com/img/habr_ru.png' language = 'ru' no_stylesheets = True remove_javascript = False auto_cleanup = False oldest_article = 7 max_articles_per_feed = 50 remove_tags_before = dict(name='h1') remove_tags_after = dict(name='div', attrs={'class': 'tm-misprint-area'}) remove_tags = [dict(name='div', attrs={'class': 'tm-article-presenter__meta'}), dict(name='div', attrs={'class': 'tm-article-poll'})] feeds = [ ('\u041d\u043e\u0432\u043e\u0441\u0442\u0438', 'https://habr.com/ru/rss/news/?fl=ru'), ('\u0412\u0441\u0435 \u043c\u0430\u0442\u0435\u0440\u0438\u0430\u043b\u044b', 'https://habr.com/ru/rss/all/all/?fl=ru'), ('\u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u226510', 'https://habr.com/ru/rss/all/top10/?fl=ru'), ('\u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u226525', 'https://habr.com/ru/rss/all/top25/?fl=ru'), ('\u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u226550', 'https://habr.com/ru/rss/all/top50/?fl=ru'), ('\u0420\u0435\u0439\u0442\u0438\u043d\u0433 \u2265100', 'https://habr.com/ru/rss/all/top100/?fl=ru'), ] def preprocess_html(self, soup): for img in soup.findAll('img', attrs={'data-src': True}): img['src'] = img['data-src'] return soup