Debian Codegraph @

recipes/jot_down.recipe

raw
1 #!/usr/bin/env python
2 __license__ = 'GPL v3'
3 __copyright__ = '23 June 2013, desUBIKado'
4 __author__ = 'desUBIKado'
5 __description__ = 'Contemporary Culture Magazine'
6 __version__ = 'v0.03'
7 __date__ = '28, July 2016'
8 '''
9 http://www.jotdown.es/
10 '''
11
12 import re
13
14 from calibre.web.feeds.news import BasicNewsRecipe
15
16
17 class jotdown(BasicNewsRecipe):
18 author = 'desUBIKado'
19 description = 'Revista digital con magníficos y extensos artículos'
20 title = 'Jot Down - Contemporary Culture Magazine'
21 publisher = 'Wabi Sabi Investments, S.C.'
22 category = 'Opinion, culture, science, movies, TV shows, music, blogs'
23 language = 'es'
24 timefmt = '[%a, %d %b, %Y]'
25 oldest_article = 7
26 delay = 1
27 max_articles_per_feed = 20
28 masthead_url = 'http://www.jotdown.es/wp-content/uploads/2011/04/logoJotDown.png'
29 use_embedded_content = False
30 remove_javascript = True
31 no_stylesheets = True
32
33 feeds = [('Portada', 'http://www.jotdown.es/feed/')]
34
35 keep_only_tags = [
36 dict(name='div', attrs={'class': ['entry-content']}),
37 dict(name='div', attrs={'id': ['comments']}),
38 ]
39
40 remove_tags = [
41 dict(name='a', attrs={'href': ['http://alternativaseconomicas.coop/']}),
42 dict(name='div', attrs={'class': ['reply', 'after-meta', 'tags_list', 'wp_rp_wrap wp_rp_plain', 'after-meta', 'share_box']}),
43 dict(name='div', attrs={'align': ['center']}),
44 dict(name='span', attrs={'class': ['fbreplace', 'says']}),
45 dict(name='img', attrs={'class': ['avatar avatar-60 photo']}),
46 dict(name='li', attrs={'class': ['post pingback']}),
47 dict(name='div', attrs={'id': 'respond'}),
48 ]
49
50 remove_tags_after = dict(name='div', attrs={'id': 'respond'})
51
52 preprocess_regexps = [
53 # To change the small size of the text
54 (re.compile(r'font-size: small', re.DOTALL | re.IGNORECASE), lambda match: 'font-size: medium'),
55 # To present the image of the embedded video
56 (
57 re.compile(r'<object type="application/x-shockwave-flash" data="http://www.youtube.com/v', re.DOTALL | re.IGNORECASE),
58 lambda match: '<img src="http://img.youtube.com/vi',
59 ),
60 (re.compile(r'&rel=0&fs=1"', re.DOTALL | re.IGNORECASE), lambda match: '/0.jpg"><object'),
61 # To remove the link of the category
62 (re.compile(r'<div class="meta">', re.DOTALL | re.IGNORECASE), lambda match: '<div class="meta"><!-- '),
63 (re.compile(r'</a>, <a href="http://www.jotdown.es/category', re.DOTALL | re.IGNORECASE), lambda match: ', <!--'),
64 (re.compile(r'"category tag">', re.DOTALL | re.IGNORECASE), lambda match: '--> '),
65 (re.compile(r'</a> &mdash;', re.DOTALL | re.IGNORECASE), lambda match: ''),
66 # To remove the link of the title
67 (re.compile(r'<h1 class="title"><a href="', re.DOTALL | re.IGNORECASE), lambda match: '<h1 class="title"><div class="'),
68 (re.compile(r'</a></h1>', re.DOTALL | re.IGNORECASE), lambda match: '</div></h1>'),
69 ]