add cls telegraph

This commit is contained in:
hillerliao
2021-08-21 10:02:44 +08:00
parent adfd9f8db6
commit becc97a49a
3 changed files with 43 additions and 1 deletions

View File

@@ -118,7 +118,12 @@ def xuangubao_xuangubao(type='', category=''):
@bp.route('/cls/subject/<string:category>')
def cls_subject(category=''):
from rsshub.spiders.cls.subject import ctx
return render_template('main/atom.xml', **filter_content(ctx(category)))
return render_template('main/atom.xml', **filter_content(ctx(category)))
@bp.route('/cls/telegraph/')
def cls_telegraph():
from rsshub.spiders.cls.telegraph import ctx
return render_template('main/atom.xml', **filter_content(ctx()))
@bp.route('/chaindd/column/<string:category>')
def chaindd_column(category=''):

View File

@@ -0,0 +1,25 @@
import requests
from rsshub.utils import DEFAULT_HEADERS
def parse(post):
item = {}
item['title'] = post['title'] if post['title'] != '' else post['content']
item['description'] = post['content']
item['link'] = post['shareurl']
item['pubDate'] = post['ctime']
return item
def ctx():
url = f'https://www.cls.cn/nodeapi/telegraphList'
res = requests.get(url, headers=DEFAULT_HEADERS)
posts = res.json()['data']['roll_data']
items = list(map(parse, posts))
return {
'title': f'电报 - 财联社',
'link': f'https://www.cls.cn/telegraph',
'description': f'财联社电报',
'author': 'hillerliao',
'items': items
}

View File

@@ -181,6 +181,18 @@
<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://pyrsshub.herokuapp.com/cls/telegraph" target="_blank">https://pyrsshub.herokuapp.com/cls/telegraph</a></p>
<p class="card-text">路由:<code>/cls/telegraph</code></p>
</div>
</div>
<br>
<!--item info end-->
<!--item info start-->
<div class="card text-left">
<div class="card-body">