| 1 |
import re |
| 2 |
|
| 3 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 4 |
|
| 5 |
|
| 6 |
class GithubBlog(BasicNewsRecipe): |
| 7 |
title = 'Github Blog' |
| 8 |
language = 'en' |
| 9 |
description = 'Updates, ideas, and inspiration from GitHub to help developers build and design software.' |
| 10 |
cover_url = 'https://github.githubassets.com/assets/GitHub-Mark-ea2971cee799.png' |
| 11 |
masthead_url = 'https://github.githubassets.com/assets/GitHub-Logo-ee398b662d42.png' |
| 12 |
|
| 13 |
oldest_article = 14 |
| 14 |
|
| 15 |
keep_only_tags = [ |
| 16 |
dict(name='div', attrs={'class': 'col-12 offset-lg-1 col-lg-10 col-xl-7 mt-5 mt-lg-10 mb-6 mb-lg-8'}), |
| 17 |
dict(name='section', attrs={'class': lambda x: x and 'post__content' in x.split(' ')}), |
| 18 |
] |
| 19 |
|
| 20 |
remove_tags = [ |
| 21 |
dict(name='div', attrs={'class': lambda x: x and 'post-tags' in x.split(' ')}), |
| 22 |
dict(name='ul', attrs={'class': lambda x: x and 'post-hero__categories' in x.split(' ')}), |
| 23 |
] |
| 24 |
|
| 25 |
preprocess_regexps = [ |
| 26 |
# Styles the article description |
| 27 |
(re.compile(r'(<p class="[^"]*f4-mktg[^>]*>)([^<]*)(</p>)'), lambda m: '<h3>%s</h3>' % (m.group(2))) |
| 28 |
] |
| 29 |
|
| 30 |
use_embedded_content = False |
| 31 |
no_stylesheets = True |
| 32 |
|
| 33 |
feeds = [ |
| 34 |
('Engineering', 'https://github.blog/category/engineering/feed/'), |
| 35 |
('Product', 'https://github.blog/category/product/feed/'), |
| 36 |
('Security', 'https://github.blog/category/security/feed/'), |
| 37 |
('Open Source', 'https://github.blog/category/open-source/feed/'), |
| 38 |
('Enterprise', 'https://github.blog/category/enterprise/feed/'), |
| 39 |
('Community', 'https://github.blog/category/community/feed/'), |
| 40 |
('Education', 'https://github.blog/category/education/feed/'), |
| 41 |
('Company', 'https://github.blog/category/company/feed/'), |
| 42 |
('Policy', 'https://github.blog/category/policy/feed/'), |
| 43 |
] |