calibre/recipes/sobaka.recipe
un-pogaz ed2930712d various whitespace (extra-edit)
!partial 'E203,E222,E241,E271,E272'
2025-01-24 11:14:24 +01:00

42 lines
1.9 KiB
Python

#!/usr/bin/env python
# vim:fileencoding=utf-8
from calibre.web.feeds.news import BasicNewsRecipe
class Sobaka(BasicNewsRecipe):
title = '\u0421\u043E\u0431\u0430\u043A\u0430.ru'
__author__ = 'bugmen00t'
description = '\u0416\u0443\u0440\u043D\u0430\u043B \u043E \u043B\u044E\u0434\u044F\u0445 \u0432 \u041F\u0435\u0442\u0435\u0440\u0431\u0443\u0440\u0433\u0435' # noqa: E501
publisher = '\u041E\u041E\u041E \u00AB\u0416\u0443\u0440\u043D\u0430\u043B\u044B \u0438 \u0441\u0430\u0439\u0442\u044B "\u0424\u0430\u0431\u0440\u0438\u043A\u0430 \u043A\u043E\u043D\u0442\u0435\u043D\u0442\u0430 "\u0422\u043E\u0447\u043A\u0430 \u0420\u0443"\u00BB' # noqa: E501
category = 'magazine'
cover_url = u'https://static.sobaka.ru/images/post/00/04/31/21/_rotator.jpg'
language = 'ru'
no_stylesheets = False
remove_javascript = False
auto_cleanup = False
oldest_article = 7
max_articles_per_feed = 50
remove_tags_before = dict(name='div', attrs={'class': 'b-post-view__head'})
remove_tags_after = dict(name='div', attrs={'class': 'b-post-view__foot'})
remove_tags = [
dict(name='div', attrs={'class': 'b-post-view__telegram-promo'}),
dict(name='div', attrs={'class': 'b-post-view__tgb'}),
dict(name='div', attrs={'id': 'comments'}),
dict(name='div', attrs={'class': 'b-post-view__section'}),
dict(name='div', attrs={'class': 'b-post-view__share'}),
dict(name='div', attrs={'class': 'b-post-view__details-col b-post-view__details-col--w1'})
]
feeds = [
('\u041D\u043E\u0432\u043E\u0441\u0442\u0438', 'https://www.sobaka.ru/rss/news.xml')
]
def preprocess_html(self, soup):
for img in soup.findAll('img', attrs={'data-src': True}):
img['src'] = img['data-src']
return soup