| 1 |
import re |
| 2 |
|
| 3 |
from calibre.web.feeds.recipes import BasicNewsRecipe |
| 4 |
|
| 5 |
|
| 6 |
class todenikRecipe(BasicNewsRecipe): |
| 7 |
__author__ = 'bubak' |
| 8 |
title = 'Deník To' |
| 9 |
description = 'denik.to' |
| 10 |
oldest_article = 1 |
| 11 |
max_articles_per_feed = 20 |
| 12 |
|
| 13 |
feeds = [('Deník TO', 'https://denik.to/rss')] |
| 14 |
|
| 15 |
language = 'cs' |
| 16 |
cover_url = 'https://denik.to/wp-content/uploads/2023/06/logo.svg' |
| 17 |
remove_javascript = True |
| 18 |
no_stylesheets = True |
| 19 |
use_embedded_content = False |
| 20 |
|
| 21 |
ignore_duplicate_articles = {'title', 'url'} |
| 22 |
|
| 23 |
remove_attributes = [] |
| 24 |
remove_tags_after = dict(name='div', attrs={'id': 'comments'}) |
| 25 |
remove_tags = [ |
| 26 |
dict(name='div', attrs={'class': ['picture', 'top-tags', 'caption']}), |
| 27 |
dict(name='div', attrs={'class': re.compile(r'hustle|sidebar-widget|breadcrumbs|inline-post|byline', re.IGNORECASE)}), |
| 28 |
dict(name='div', attrs={'id': 'comments'}), |
| 29 |
dict(name='figure'), |
| 30 |
dict(name='aside'), |
| 31 |
dict(name='footer'), |
| 32 |
] |
| 33 |
|
| 34 |
keep_only_tags = [dict(name='main')] |
| 35 |
preprocess_regexps = [ |
| 36 |
(re.compile(r'<a\s[^>]*>(<[^>]*>)*([^<]*)(<[^>]*>)*</a>', re.DOTALL | re.IGNORECASE), lambda match: match.group(2)), |
| 37 |
] |
| 38 |
|
| 39 |
def get_browser(self, *a, **kw): |
| 40 |
from calibre import browser |
| 41 |
|
| 42 |
kw['user_agent'] = 'Silver' |
| 43 |
return browser(*a, **kw) |