mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 23:16:50 +00:00
add cls telegraph
This commit is contained in:
@@ -120,6 +120,11 @@ def cls_subject(category=''):
|
|||||||
from rsshub.spiders.cls.subject import ctx
|
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>')
|
@bp.route('/chaindd/column/<string:category>')
|
||||||
def chaindd_column(category=''):
|
def chaindd_column(category=''):
|
||||||
from rsshub.spiders.chaindd.column import ctx
|
from rsshub.spiders.chaindd.column import ctx
|
||||||
|
|||||||
25
rsshub/spiders/cls/telegraph.py
Normal file
25
rsshub/spiders/cls/telegraph.py
Normal 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
|
||||||
|
}
|
||||||
@@ -181,6 +181,18 @@
|
|||||||
<br>
|
<br>
|
||||||
<!--item info end-->
|
<!--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-->
|
<!--item info start-->
|
||||||
<div class="card text-left">
|
<div class="card text-left">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|||||||
Reference in New Issue
Block a user