mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-06-09 23:16:57 +00:00
nhk news easy
This commit is contained in:
@@ -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
|
||||
|
||||
29
rsshub/spiders/nhk/newseasy.py
Normal file
29
rsshub/spiders/nhk/newseasy.py
Normal 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)),
|
||||
}
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user