forked from ping/newsrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathjoongangdaily.recipe.py
51 lines (40 loc) · 1.59 KB
/
joongangdaily.recipe.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# Copyright (c) 2022 https://github.com/ping/
#
# This software is released under the GNU General Public License v3.0
# https://opensource.org/licenses/GPL-3.0
"""
koreajoongangdaily.joins.com
"""
import os
import sys
# custom include to share code between recipes
sys.path.append(os.environ["recipes_includes"])
from recipes_shared import BasicNewsrackRecipe, format_title
from calibre.web.feeds.news import BasicNewsRecipe
_name = "JoongAng Daily"
class KoreaJoongAngDaily(BasicNewsrackRecipe, BasicNewsRecipe):
title = _name
description = "The Korea JoongAng Daily is an English-language daily published by the JoongAng Group, Korea’s leading media group, in association with The New York Times. https://koreajoongangdaily.joins.com/"
language = "en"
__author__ = "ping"
publication_type = "newspaper"
masthead_url = (
"https://koreajoongangdaily.joins.com/resources/images/common/logo.png"
)
use_embedded_content = True
auto_cleanup = True
compress_news_images_auto_size = 10
oldest_article = 1 # days
max_articles_per_feed = 60
extra_css = """
.caption { font-size: 0.8rem; margin: 0.5rem 0; }
"""
feeds = [
("Korea JoongAng Daily", "https://koreajoongangdaily.joins.com/xmls/joins"),
]
def populate_article_metadata(self, article, __, _):
if (not self.pub_date) or article.utctime > self.pub_date:
self.pub_date = article.utctime
self.title = format_title(_name, article.utctime)
def parse_feeds(self):
return self.group_feeds_by_date(timezone_offset_hours=9) # Seoul time