mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
add benzinga ratings
This commit is contained in:
@@ -150,4 +150,9 @@ def jintiankansha_column(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)))
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/benzinga/ratings/<string:category>')
|
||||
def benzinga_ratings(category=''):
|
||||
from rsshub.spiders.benzinga.ratings import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
27
rsshub/spiders/benzinga/ratings.py
Normal file
27
rsshub/spiders/benzinga/ratings.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'https://www.benzinga.com/'
|
||||
|
||||
def ctx(category=''):
|
||||
|
||||
stock = category
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['description'] = item['title'] = stock.upper() + '的评级:' + ', '.join(post.css('td::text').extract())
|
||||
return item
|
||||
|
||||
url = f'{domain}/stock/{category}/ratings'
|
||||
tree = fetch(url, headers=DEFAULT_HEADERS)
|
||||
posts = tree.css('tr')
|
||||
items = list(map(parse, posts))
|
||||
|
||||
column_title = tree.css('title::text').extract_first()
|
||||
return {
|
||||
'title': f'{column_title} - benzinga',
|
||||
'description': f'{column_title} - benzinga',
|
||||
'link': url,
|
||||
'author': f'hillerliao',
|
||||
'items': items
|
||||
}
|
||||
@@ -270,4 +270,17 @@
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
<h4 class="card-title">股票评级 - Benzinga</h4>
|
||||
<h6 class="text-muted">股票评级 - Benzinga <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/benzinga/ratings/wb" target="_blank">https://pyrsshub.herokuapp.com/benzinga/ratings/wb</a></p>
|
||||
<p class="card-text">路由:<code>/benzinga/ratings/:category</code></p>
|
||||
<p class="card-text">参数:category [必填, 股票代码] </p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user