nhk news easy

This commit is contained in:
Hiller Liao
2023-07-02 23:11:03 +08:00
parent b9bb677cd0
commit 157bcb4cb6
3 changed files with 47 additions and 0 deletions

View File

@@ -296,6 +296,12 @@ def sysu_ifcen(category='', keywords=''):
from rsshub.spiders.sysu.ifcen import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
@bp.route('/nhk/newseasy')
@cache.cached(timeout=3600)
def nhk_newseasy(category='', keywords=''):
from rsshub.spiders.nhk.newseasy import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
@bp.route('/filter/')
def rss_filter():
from rsshub.spiders.rssfilter.filter import ctx

View File

@@ -0,0 +1,29 @@
import json
import requests
from rsshub.utils import DEFAULT_HEADERS
domain = 'https://www3.nhk.or.jp'
def parse(post):
item = {}
item['title'] = post['title']
item['description'] = post['title_with_ruby'] + '<br/><br/>' + post['outline_with_ruby']
item['link'] = f"{domain}/news/easy/{post['news_id']}/{post['news_id']}.html"
return item
def ctx(category=''):
url = f'{domain}/news/easy/top-list.json'
posts = requests.get(
url,
headers=DEFAULT_HEADERS,
).text
posts = json.loads(posts)
return {
'title': 'News Web Easy - NHK',
'link': f'{domain}/news/easy/',
'description': 'NEWS WEB EASYは、小学生・中学生の皆さんや、日本に住んでいる外国人のみなさんに、わかりやすいことば でニュースを伝えるウェブサイトです。',
'author': 'hillerliao',
'items': list(map(parse, posts)),
}

View File

@@ -42,6 +42,18 @@
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">
<h4 class="card-title">NHK</h4>
<h6 class="text-muted">NHK - Web News Easy <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
<p class="card-text">举例:<a href="https://pyrsshub.vercel.app/nhk/newseasy" target="_blank">https://pyrsshub.vercel.app/nhk/newseasy</a></p>
<p class="card-text">路由:<code>/nhk/newseasy</code></p>
</div>
</div>
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">