mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 07:26:44 +00:00
add yfchuhai express
This commit is contained in:
@@ -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()))
|
||||
29
rsshub/spiders/yfchuhai/express.py
Normal file
29
rsshub/spiders/yfchuhai/express.py
Normal 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))
|
||||
}
|
||||
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user