diff --git a/rsshub/blueprints/main.py b/rsshub/blueprints/main.py index bb87048..0292397 100644 --- a/rsshub/blueprints/main.py +++ b/rsshub/blueprints/main.py @@ -99,4 +99,9 @@ def caixin_scroll(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 + return render_template('main/atom.xml', **filter_content(ctx(type,category))) + +@bp.route('/xuangubao//') +def xuangubao_xuangubao(type='', category=''): + from rsshub.spiders.xuangubao.xuangubao import ctx + return render_template('main/atom.xml', **filter_content(ctx(type, category))) \ No newline at end of file diff --git a/rsshub/spiders/xuangubao/xuangubao.py b/rsshub/spiders/xuangubao/xuangubao.py new file mode 100644 index 0000000..702c6a6 --- /dev/null +++ b/rsshub/spiders/xuangubao/xuangubao.py @@ -0,0 +1,31 @@ +import requests +import json +from rsshub.utils import DEFAULT_HEADERS + + +def parse(post): + item = {} + item['title'] = post['Title'] + item['description'] = post['Summary'] if post['Summary'] != '' else post['Title'] + item['link'] = post['OriginalUrl'] if post['OriginalUrl'] != '' else post['Url'] if post['Url'] !='' else post['ShareUrl2'] + item['author'] = post['Source'] + post['DisplayAuthor'] + item['pubDate'] = post['CreatedAt'] + return item + + +def ctx(type='', category=''): + api_subpath = 'bkjMsgs' if type=='theme' else 'subj' + url = f'https://api.xuangubao.cn/api/pc/{api_subpath}/{category}?limit=20' + print(url) + res = requests.get(url) + res = json.loads(res.text) + posts = res['Messages'] + theme_name = res['BkjName'] if type=='theme' else res['Subject']['Title'] + items = list(map(parse, posts)) + return { + 'title': f'{theme_name} - 主题 - 选股宝', + 'link': f'https://xuangubao.cn/subject/bkj/{category}', + 'description': f'{theme_name} 板块/主题动态 - 选股宝', + 'author': 'hillerliao', + 'items': items + } diff --git a/rsshub/templates/main/feeds.html b/rsshub/templates/main/feeds.html index 8432d88..4a8273d 100644 --- a/rsshub/templates/main/feeds.html +++ b/rsshub/templates/main/feeds.html @@ -137,4 +137,30 @@
+ + +
+
+

东方财富网行业/个股研报

+
东方财富网行业/个股研报 by hillerliao
+

举例:https://rsshub-python.herokuapp.com/eastmoney/report/stock/473

+

路由:/eastmoney/report/:type/:category

+

参数:type, category [必填,见财新网滚动频道 http://www.caixin.com/search/scroll/0.jsp]

+
+
+
+ + + +
+
+

选股宝板块/主题动态

+
选股宝板块/主题动态 by hillerliao
+

举例:https://rsshub-python.herokuapp.com/xuangubao/theme/17006066

+

路由:/xuangubao/:type/:category

+

参数:type = theme|subject, category [必填,板块/主题ID]

+
+
+
+ {% endblock content %} \ No newline at end of file