mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 07:26:44 +00:00
cailianshe press subject
This commit is contained in:
@@ -104,4 +104,9 @@ def eastmoney_report(category='', type=''):
|
||||
@bp.route('/xuangubao/<string:type>/<string:category>')
|
||||
def xuangubao_xuangubao(type='', category=''):
|
||||
from rsshub.spiders.xuangubao.xuangubao import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(type, category)))
|
||||
return render_template('main/atom.xml', **filter_content(ctx(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)))
|
||||
29
rsshub/spiders/cls/subject.py
Normal file
29
rsshub/spiders/cls/subject.py
Normal file
@@ -0,0 +1,29 @@
|
||||
import requests
|
||||
import json
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = post['ArticleTitle']
|
||||
item['description'] = post['ArticleBrief']
|
||||
articleid = post['ArticleId']
|
||||
item['link'] = f'https://api3.cls.cn/share/article/{articleid}?os=android&sv=734&app='
|
||||
item['author'] = post['ArticleAuthor']
|
||||
item['pubDate'] = post['ArticleTime']
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
url = f'https://i.cls.cn/articles/subject/v1/{category}?sign=ab07b305da92f72ea5e509ba6d1216ff&app=cailianpress&LastTime=&PageNum=20&os=android&sv=734'
|
||||
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||
res = json.loads(res.text)
|
||||
posts = res
|
||||
items = list(map(parse, posts))
|
||||
return {
|
||||
'title': f'{category} - 主题 - 财联社',
|
||||
'link': f'https://api3.cls.cn/share/subject/{category}?os=android&sv=734',
|
||||
'description': f'{category} - 主题 - 财联社',
|
||||
'author': 'hillerliao',
|
||||
'items': items
|
||||
}
|
||||
@@ -163,4 +163,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/cls/subject/1345" target="_blank">https://rsshub-python.herokuapp.com/cls/subject/1345</a></p>
|
||||
<p class="card-text">路由:<code>/cls/subject/:category</code></p>
|
||||
<p class="card-text">参数:category [必填,见财联社APP主题栏目]</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
{% endblock content %}
|
||||
Reference in New Issue
Block a user