add yfchuhai express

This commit is contained in:
hillerliao
2021-11-16 12:30:29 +08:00
parent da7bc33563
commit 4cd8c0f2d2
3 changed files with 47 additions and 1 deletions

View File

@@ -193,4 +193,9 @@ def mp_gh(gh=''):
@bp.route('/mp/youwuqiong/<string:author>')
def mp_youwuqiong(author=''):
from rsshub.spiders.mp.youwuqiong import ctx
return render_template('main/atom.xml', **filter_content(ctx(author)))
return render_template('main/atom.xml', **filter_content(ctx(author)))
@bp.route('/yfchuhai/express/')
def yfchuhai_express():
from rsshub.spiders.yfchuhai.express import ctx
return render_template('main/atom.xml', **filter_content(ctx()))

View File

@@ -0,0 +1,29 @@
import requests
from rsshub.utils import DEFAULT_HEADERS
domain = 'https://www.yfchuhai.com'
def parse(post):
item = {}
item['title'] = post['title']
item['description'] = post['content']
item['link'] = f"https://www.yfchuhai.com/news/{post['id']}.html"
#item['pubDate'] = post['createTime']
item['author'] = post['source']
return item
def ctx(category=''):
DEFAULT_HEADERS.update({'Referer': 'https://www.yfchuhai.com/news/'})
r_url = f'{domain}/api/News/getList'
print(r_url)
posts = requests.get(r_url, headers=DEFAULT_HEADERS).json()['data']['list']
user_name = posts[0]
return {
'title': '快讯 - 扬帆出海',
'link': 'https://www.yfchuhai.com/news/',
'description': '快讯 - 扬帆出海',
'author': 'hillerliao',
'items': list(map(parse, posts))
}

View File

@@ -243,6 +243,18 @@
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">
<h4 class="card-title">扬帆出海-快讯</h4>
<h6 class="text-muted">扬帆出海-快讯 <a href="https://github.com/hillerliao" target="_blank" class="badge badge-secondary">by hillerliao</a></h6>
<p class="card-text">举例:<a href="https://pyrsshub.herokuapp.com/yfchuhai/express/" target="_blank">https://pyrsshub.herokuapp.com/yfchuhai/express/</a></p>
<p class="card-text">路由:<code>/yfchuhai/express/</code></p>
</div>
</div>
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">