mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 23:16:50 +00:00
add interotc cpgg
This commit is contained in:
@@ -139,4 +139,9 @@ def weiyangx_tag(category=''):
|
||||
@bp.route('/jintiankansha/column/<string:category>')
|
||||
def jintiankansha_column(category=''):
|
||||
from rsshub.spiders.jintiankansha.column import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/interotc/cpgg/<string:category>')
|
||||
def interotc_cpgg(category=''):
|
||||
from rsshub.spiders.interotc.cpgg import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
35
rsshub/spiders/interotc/cpgg.py
Normal file
35
rsshub/spiders/interotc/cpgg.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import requests
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://www.interotc.com.cn'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
end_date = ''
|
||||
if '东兴证券' in post['TITLE']:
|
||||
end_date = post['CONTENT'].split('存续期到期日')[1].split('。')[0]
|
||||
item['title'] = post['TITLE'] + ' (' + post['CPDM'] + ', ' + post['CPMC'] + ', ' + end_date + ')'
|
||||
item['description'] = post['CONTENT']
|
||||
item['link'] = f'{domain}/portal/newportal/cpggDetail.html?bdid=' + str(post['BDID'])
|
||||
item['pubDate'] = post['FBSJ']
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
DEFAULT_HEADERS.update({'Host': 'www.interotc.com.cn'})
|
||||
url = f'{domain}/zzjsInterface/interface/fixedIncome/lettersListNew.json'
|
||||
# req_params = {'pageSize': '10','startDate':'-1', 'keyword': category, 'pageIndex': '1'}
|
||||
# posts = requests.post(url, \
|
||||
# data=req_params, headers=DEFAULT_HEADERS)
|
||||
req_params = f'?keyword={category}&pageSize=30'
|
||||
posts = requests.get(url+req_params)
|
||||
import json
|
||||
posts = json.loads(posts.text)['resultSet']
|
||||
return {
|
||||
'title': f'{category} - 产品公告 - 机构间市场',
|
||||
'link': f'{domain}/portal/newportal/cpgg.html',
|
||||
'description': f'{category}的产品公告',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -253,4 +253,17 @@
|
||||
<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/interotc/cpgg/东兴证券" target="_blank">https://pyrsshub.herokuapp.com/interotc/cpgg/东兴证券</a></p>
|
||||
<p class="card-text">路由:<code>/interotc/cpgg/:category</code></p>
|
||||
<p class="card-text">参数:category [必填,标题中的关键词] </p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user