optimize bjnews

This commit is contained in:
hillerliao
2022-05-15 14:41:25 +08:00
parent e8ffba0776
commit 16c001c300
3 changed files with 23 additions and 5 deletions

View File

@@ -215,6 +215,11 @@ def yfchuhai_express():
from rsshub.spiders.yfchuhai.express import ctx
return render_template('main/atom.xml', **filter_content(ctx()))
@bp.route('/bjnews/<string:category>')
def bjnews_channel(category=''):
from rsshub.spiders.bjnews.channel import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
'''
@bp.route('/test')
@bp.route('/test/测试')

View File

@@ -14,12 +14,12 @@ def ctx(category=''):
r_url = f"{domain}/{category}"
tree = fetch(r_url)
html = tree.css('body')
posts = tree.css('.list-a')
channel_title = html.css('a.cur::text').extract_first()
posts = tree.css('.list-a').css('li')
channel_title = html.css('a.cur::text').extract_first().strip()
return {
'title': channel_title,
'title': f'{channel_title} - 新京报',
'link': r_url,
'description': '新京报频道新闻',
'description': f'新京报{channel_title}频道新闻',
'author': 'hillerliao',
'items': list(map(parse, posts))
}

View File

@@ -145,7 +145,7 @@
<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.deta.dev/eastmoney/report/stock/473" target="_blank">https://rsshub.deta.dev/eastmoney/report/stock/473</a></p>
<p class="card-text">路由:<code>/eastmoney/report/:type/:category</code></p>
<p class="card-text">参数type, category [必填,见财新网滚动频道 http://www.caixin.com/search/scroll/0.jsp]</p>
<p class="card-text">参数type, category [必填,见东方财富网研报频道 ]</p>
</div>
</div>
<br>
@@ -394,6 +394,19 @@
<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.deta.dev/bjnews/beijing" target="_blank">https://rsshub.deta.dev/bjnews/beijing</a></p>
<p class="card-text">路由:<code>/bjnews/:channelid</code></p>
<p class="card-text">channelid [必填, 频道 id]</p>
</div>
</div>
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">