| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
|
| 4 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 5 |
|
| 6 |
|
| 7 |
class TJournal(BasicNewsRecipe): |
| 8 |
title = 'TJournal' |
| 9 |
__author__ = 'bug_me_not (with fixes by bugmen00t)' |
| 10 |
description = 'TJournal: издание о медиа, технологиях и трендах' |
| 11 |
publisher = 'tjournal.ru' |
| 12 |
category = 'news' |
| 13 |
language = 'ru' |
| 14 |
no_stylesheets = False |
| 15 |
remove_javascript = True |
| 16 |
oldest_article = 30 |
| 17 |
max_articles_per_feed = 100 |
| 18 |
cover_url = 'https://tjournal.ru/static/build/tjournal.ru/images/search_logo.png' |
| 19 |
|
| 20 |
remove_tags_before = dict(name='div', attrs={'class': 'content-title"'}) |
| 21 |
|
| 22 |
remove_tags_after = dict(name='div', attrs={'class': 'content-footer content-footer--full l-island-a'}) |
| 23 |
|
| 24 |
remove_tags = [ |
| 25 |
dict(name='div', attrs={'class': 'content-footer content-footer--full l-island-a'}), |
| 26 |
dict(name='div', attrs={'air-module': 'module.distributionFloating'}), |
| 27 |
dict(name='span', attrs={'class': 'content-editorial-tick'}), |
| 28 |
dict(name='vue'), |
| 29 |
dict(name='div', attrs={'class': 'comments'}), |
| 30 |
dict(name='div', attrs={'class': 'propaganda'}), |
| 31 |
dict(name='div', attrs={'class': 'propaganda propaganda--with-footer'}), |
| 32 |
dict(name='div', attrs={'air-module': 'module.gallery'}), |
| 33 |
dict(name='div', attrs={'class': 'content-container'}), |
| 34 |
dict(name='div', attrs={'class': 'content-header__item content-header-number'}), |
| 35 |
dict(name='span', attrs={'class': 'views__value'}), |
| 36 |
dict(name='span', attrs={'class': 'views__label'}), |
| 37 |
] |
| 38 |
|
| 39 |
feeds = [ |
| 40 |
('\u041f\u043e\u043f\u0443\u043b\u044f\u0440\u043d\u043e\u0435', 'https://tjournal.ru/rss'), |
| 41 |
('\u041d\u043e\u0432\u043e\u0441\u0442\u0438', 'https://tjournal.ru/rss/news'), |
| 42 |
('\u0421\u0432\u0435\u0436\u0435\u0435', 'https://tjournal.ru/rss/new'), |
| 43 |
('\u0422\u0435\u0445\u043d\u043e\u043b\u043e\u0433\u0438\u0438', 'https://tjournal.ru/rss/tech'), |
| 44 |
('\u0420\u0430\u0437\u0431\u043e\u0440\u044b', 'https://tjournal.ru/rss/analysis'), |
| 45 |
('\u0418\u043d\u0442\u0435\u0440\u043d\u0435\u0442', 'https://tjournal.ru/rss/internet'), |
| 46 |
] |
| 47 |
|
| 48 |
def preprocess_html(self, soup): |
| 49 |
for img in soup.findAll('img', attrs={'data-image-src': True}): |
| 50 |
img['src'] = img['data-image-src'] |
| 51 |
return soup |