mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-09-29 15:31:08 -04:00
84 lines
2.5 KiB
Plaintext
84 lines
2.5 KiB
Plaintext
__license__ = 'GPL v3'
|
|
__copyright__ = '2008-2012, Darko Miletic <darko.miletic at gmail.com>'
|
|
'''
|
|
harpers.org
|
|
'''
|
|
from calibre.web.feeds.news import BasicNewsRecipe
|
|
|
|
|
|
class Harpers(BasicNewsRecipe):
|
|
title = u"Harper's Magazine"
|
|
__author__ = u'Darko Miletic'
|
|
language = 'en'
|
|
description = u"Harper's Magazine: Founded June 1850."
|
|
publisher = "Harper's Magazine "
|
|
category = 'news, politics, USA'
|
|
oldest_article = 30
|
|
max_articles_per_feed = 100
|
|
no_stylesheets = True
|
|
use_embedded_content = False
|
|
|
|
conversion_options = {
|
|
'comment': description, 'tags': category, 'publisher': publisher, 'language': language
|
|
}
|
|
|
|
keep_only_tags = [
|
|
dict(
|
|
class_=[
|
|
"article-content",
|
|
"template-index-archive", # harper's index
|
|
]
|
|
)
|
|
]
|
|
remove_tags = [
|
|
dict(
|
|
class_=[
|
|
"component-newsletter-signup",
|
|
"sidebar",
|
|
"header-meta",
|
|
"component-from-author",
|
|
"from-issue",
|
|
"d-none",
|
|
"COA_roles_fix_space",
|
|
"section-tags",
|
|
"aria-font-adjusts",
|
|
"component-share-buttons",
|
|
"index-footer",
|
|
"index-prev-link",
|
|
"comma",
|
|
]
|
|
),
|
|
# for harper's index
|
|
dict(
|
|
class_=[
|
|
"aria-font-adjusts",
|
|
"component-share-buttons",
|
|
"index-footer",
|
|
"index-prev-link",
|
|
]
|
|
),
|
|
]
|
|
remove_attributes = ["style", "width", "height"]
|
|
|
|
extra_css = """
|
|
h1.article-title { font-size: x-large; margin-bottom: 0.4rem; }
|
|
.subheading, .post-subtitle { font-size: large; font-style: italic; margin-bottom: 1rem; }
|
|
.byline { margin-bottom: 1rem }
|
|
.article-hero-img img, .flex-section-image img, .wp-caption img {
|
|
display: block; margin-bottom: 0.3rem; max-width: 100%; height: auto;
|
|
box-sizing: border-box;
|
|
}
|
|
.wp-caption-text { font-size: small; margin-top: 0.3rem; }
|
|
|
|
.author-bio { margin-top: 2.5rem; font-style: italic; }
|
|
.author-bio em { font-weight: bold; }
|
|
|
|
.index-item { font-size: large; margin: 1rem 0; }
|
|
.index-statement > p { display: inline-block; margin: 0.5rem 0; }
|
|
.index-statement > span { display: inline-block; }
|
|
.index-statement .index-tooltip { font-size: small; }
|
|
"""
|
|
|
|
|
|
feeds = [(u"Harper's Magazine", u'https://harpers.org/feed/')]
|