diff --git a/rsshub/blueprints/main.py b/rsshub/blueprints/main.py index c4513a5..bb87048 100644 --- a/rsshub/blueprints/main.py +++ b/rsshub/blueprints/main.py @@ -94,4 +94,9 @@ def csrc_audit(category=''): @bp.route('/caixin/scroll/') def caixin_scroll(category=''): from rsshub.spiders.caixin.scroll import ctx - return render_template('main/atom.xml', **filter_content(ctx(category))) \ No newline at end of file + return render_template('main/atom.xml', **filter_content(ctx(category))) + +@bp.route('/eastmoney/report//') +def eastmoney_report(category='', type=''): + from rsshub.spiders.eastmoney.report import ctx + return render_template('main/atom.xml', **filter_content(ctx(type,category))) \ No newline at end of file diff --git a/rsshub/spiders/eastmoney/report.py b/rsshub/spiders/eastmoney/report.py new file mode 100644 index 0000000..5776f17 --- /dev/null +++ b/rsshub/spiders/eastmoney/report.py @@ -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 + } diff --git a/rsshub/templates/main/atom.xml b/rsshub/templates/main/atom.xml index 27481ae..0cb6491 100644 --- a/rsshub/templates/main/atom.xml +++ b/rsshub/templates/main/atom.xml @@ -17,6 +17,7 @@ {{item.pubDate|default(now)}} + ![CDATA[{{item.author|safe}}]] {% endfor %} \ No newline at end of file