Debian Codegraph @

recipes/asianreviewofbooks.recipe

raw
1 #!/usr/bin/env python
2 # -*- mode: python -*-
3 # -*- coding: utf-8 -*-
4
5 __license__ = 'GPL v3'
6 __copyright__ = '2012-2017, Darko Miletic <darko.miletic at gmail.com>'
7 '''
8 asianreviewofbooks.com
9 '''
10
11 from calibre.web.feeds.news import BasicNewsRecipe, classes
12
13
14 class AsianReviewOfBooks(BasicNewsRecipe):
15 title = 'The Asian Review of Books'
16 __author__ = 'Darko Miletic'
17 description = 'In addition to reviewing books about or of relevance to Asia, the Asian Review of Books also features long-format essays by leading Asian writers and thinkers, to providing an unparalleled forum for discussion of key contemporary issues by Asians for Asia and a vehicle of intellectual depth and breadth where leading thinkers can write on the books, arts and ideas of the day. Widely quoted and referenced, with an archive of more than one thousand book reviews, it is the only web resource dedicated to Asian books. And now, with the addition of the new premium content, the Asian Review of Books, is a must-read publication.' # noqa: E501
18 publisher = 'The Asian Review of Books'
19 category = 'literature, books, reviews, Asia'
20 oldest_article = 30
21 max_articles_per_feed = 100
22 no_stylesheets = True
23 use_embedded_content = False
24 encoding = 'utf8'
25 language = 'en_CN'
26 publication_type = 'magazine'
27 auto_cleanup = False
28 masthead_url = 'https://i2.wp.com/asianreviewofbooks.com/content/wp-content/uploads/2016/09/ARBwidelogo.png'
29
30 keep_only_tags = [
31 # The single-article wrapper. WordPress emits the detail page as
32 # <article class="entry ... single-entry ...">; the "single-entry"
33 # class distinguishes it from the related-articles carousel below,
34 # where each tile is a sibling <article class="... loop-entry ...">.
35 classes('single-entry'),
36 ]
37
38 remove_tags = [
39 # Kadence theme social-share container at the foot of the body —
40 # empty SVG ghosts in the EPUB, the real icons are JS-rendered.
41 classes('kt_simple_share_container'),
42 # Post-tags footer that duplicates the category links shown above.
43 classes('entry-footer'),
44 # "Related" carousel of other reviews — title plus 6-tile splide
45 # carousel appended after the body, inside the single-entry wrapper.
46 classes('entry-related'),
47 ]
48 extra_css = '''
49 body{font-family: "Droid Serif", serif}
50 .entry-title {font-family: "Playfair Display", serif}
51 img {display: block}
52 '''
53
54 recipe_specific_options = {
55 'days': {
56 'short': 'Oldest article to download from this news source. In days ',
57 'long': 'For example, 0.5, gives you articles from the past 12 hours',
58 'default': str(oldest_article),
59 }
60 }
61
62 def __init__(self, *args, **kwargs):
63 BasicNewsRecipe.__init__(self, *args, **kwargs)
64 d = self.recipe_specific_options.get('days')
65 if d and isinstance(d, str):
66 self.oldest_article = float(d)
67
68 conversion_options = {'comment': description, 'tags': category, 'publisher': publisher, 'language': language}
69
70 feeds = [('Articles', 'http://asianreviewofbooks.com/content/feed/')]