mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-18 15:09:34 +00:00
eastmoney report
This commit is contained in:
@@ -95,3 +95,8 @@ def csrc_audit(category=''):
|
|||||||
def caixin_scroll(category=''):
|
def caixin_scroll(category=''):
|
||||||
from rsshub.spiders.caixin.scroll import ctx
|
from rsshub.spiders.caixin.scroll import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/eastmoney/report/<string:type>/<string:category>')
|
||||||
|
def eastmoney_report(category='', type=''):
|
||||||
|
from rsshub.spiders.eastmoney.report import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(type,category)))
|
||||||
37
rsshub/spiders/eastmoney/report.py
Normal file
37
rsshub/spiders/eastmoney/report.py
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import requests
|
||||||
|
import json
|
||||||
|
from parsel import Selector
|
||||||
|
from datetime import datetime, date
|
||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
if post['stockName']!='':
|
||||||
|
post['stockName'] = '[' + post['stockName'] + '] '
|
||||||
|
item['title'] = post['stockName'] + ' ' + post['title']
|
||||||
|
item['title'] = item['title'].strip()
|
||||||
|
item['description'] = item['title']
|
||||||
|
item['link'] = f"http://data.eastmoney.com/report/zw_industry.jshtml?encodeUrl={post['encodeUrl']}"
|
||||||
|
item['author'] = post['orgSName'] + ' ' + post['researcher']
|
||||||
|
item['pubDate'] = post['publishDate']
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def ctx(type='', category=''):
|
||||||
|
qTypes = {'industry': '1', 'stock': '0'}
|
||||||
|
qType = qTypes[type]
|
||||||
|
url = f'http://reportapi.eastmoney.com/report/list?\
|
||||||
|
cb=&industryCode={category}\
|
||||||
|
&pageSize=50&industry=*&rating=*&ratingChange=*\
|
||||||
|
&beginTime=&endTime=&pageNo=1&fields=&qType={qType}&orgCode=&rcode=&_=1583647953800'
|
||||||
|
res = requests.get(url)
|
||||||
|
posts = json.loads(res.text)['data']
|
||||||
|
items = list(map(parse, posts))
|
||||||
|
return {
|
||||||
|
'title': f'{category} {type}研报 - 东方财富网',
|
||||||
|
'link': f'http://data.eastmoney.com/report/{type}.jshtml?hyid={category}',
|
||||||
|
'description': f'{category} {type} 研报 - 东方财富网',
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': items
|
||||||
|
}
|
||||||
@@ -17,6 +17,7 @@
|
|||||||
<updated>{{item.pubDate|default(now)}}</updated>
|
<updated>{{item.pubDate|default(now)}}</updated>
|
||||||
<link href="{{item.link}}"/>
|
<link href="{{item.link}}"/>
|
||||||
<content type="html" src="{{item.link}}"><![CDATA[{{item.description|safe}}]]></content>
|
<content type="html" src="{{item.link}}"><![CDATA[{{item.description|safe}}]]></content>
|
||||||
|
<author>![CDATA[{{item.author|safe}}]]</author>
|
||||||
</entry>
|
</entry>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</feed>
|
</feed>
|
||||||
Reference in New Issue
Block a user