mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
财新网滚动新闻
This commit is contained in:
@@ -89,4 +89,9 @@ def jiemian_newsflash(category=''):
|
||||
@bp.route('/csrc/audit/<string:category>')
|
||||
def csrc_audit(category=''):
|
||||
from rsshub.spiders.csrc.audit import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/caixin/scroll/<string:category>')
|
||||
def caixin_scroll(category=''):
|
||||
from rsshub.spiders.caixin.scroll import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
25
rsshub/spiders/caixin/scroll.py
Normal file
25
rsshub/spiders/caixin/scroll.py
Normal file
@@ -0,0 +1,25 @@
|
||||
from rsshub.utils import fetch
|
||||
|
||||
domain = 'http://www.caixin.com'
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post.css('a::text').extract_first()
|
||||
item['description'] = post.css('p::text').extract_first()
|
||||
item['link'] = post.css('a::attr(href)').extract_first()
|
||||
item['pubDate'] = post.css('span::text').extract_first()
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
tree = fetch(f"{domain}/search/scroll/{category}.jsp")
|
||||
posts = tree.css('dl')
|
||||
channel_title = tree.css('b').css('b::text').extract_first()
|
||||
return {
|
||||
'title': channel_title,
|
||||
'link': f'{domain}/search/scroll/{category}.jsp',
|
||||
'description': '财新网滚动新闻',
|
||||
'author': 'hillerliao',
|
||||
'items': list(map(parse, posts))
|
||||
}
|
||||
@@ -124,4 +124,17 @@
|
||||
</div>
|
||||
<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://rsshub-python.herokuapp.com/caixin/scroll/125" target="_blank">https://rsshub-python.herokuapp.com/caixin/scroll/125</a></p>
|
||||
<p class="card-text">路由:<code>/caixin/scroll/:category</code></p>
|
||||
<p class="card-text">参数:category [必填,见财新网滚动频道 http://www.caixin.com/search/scroll/0.jsp]</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user