| 1 |
#!/usr/bin/env python |
| 2 |
# vim:fileencoding=utf-8 |
| 3 |
from __future__ import unicode_literals |
| 4 |
|
| 5 |
import re |
| 6 |
|
| 7 |
from calibre.web.feeds.news import BasicNewsRecipe |
| 8 |
|
| 9 |
|
| 10 |
class AListApart(BasicNewsRecipe): |
| 11 |
__author__ = 'Marc Busqué <[email protected]>' |
| 12 |
__url__ = 'http://www.lamarciana.com' |
| 13 |
__version__ = '2.0.1' |
| 14 |
__license__ = 'GPL v3' |
| 15 |
__copyright__ = '2012, Marc Busqué <[email protected]>' |
| 16 |
title = 'A List Apart' |
| 17 |
description = 'A List Apart Magazine (ISSN: 1534-0295) explores the design, development, and meaning of web content, with a special focus on web standards and best practices. This recipe retrieve articles and columns.' # noqa: E501 |
| 18 |
language = 'en' |
| 19 |
tags = 'web development, software' |
| 20 |
oldest_article = 120 |
| 21 |
remove_empty_feeds = True |
| 22 |
encoding = 'utf8' |
| 23 |
cover_url = 'https://alistapart.com/wp-content/uploads/2019/03/cropped-icon_navigation-laurel-512.jpg' |
| 24 |
|
| 25 |
def __init__(self, *args, **kwargs): |
| 26 |
BasicNewsRecipe.__init__(self, *args, **kwargs) |
| 27 |
d = self.recipe_specific_options.get('days') |
| 28 |
if d and isinstance(d, str): |
| 29 |
self.oldest_article = float(d) |
| 30 |
|
| 31 |
def get_extra_css(self): |
| 32 |
if not self.extra_css: |
| 33 |
br = self.get_browser() |
| 34 |
self.extra_css = ( |
| 35 |
br |
| 36 |
.open_novisit('https://raw.githubusercontent.com/laMarciana/gutenweb/master/dist/gutenweb.css') |
| 37 |
.read() |
| 38 |
.decode('utf-8') |
| 39 |
.replace('@charset "UTF-8";', '') |
| 40 |
) |
| 41 |
return self.extra_css |
| 42 |
|
| 43 |
feeds = [ |
| 44 |
('A List Apart', 'https://alistapart.com/main/feed'), |
| 45 |
] |
| 46 |
|
| 47 |
def image_url_processor(self, baseurl, url): |
| 48 |
if re.findall(r'alistapart\.com', url): |
| 49 |
return 'http:' + url |
| 50 |
else: |
| 51 |
return url |