mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 23:16:50 +00:00
add netease comment rank
This commit is contained in:
@@ -230,6 +230,11 @@ def appstore_top(cc='', genreid=''):
|
||||
from rsshub.spiders.appstore.top import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(cc,genreid)))
|
||||
|
||||
@bp.route('/netease/comment/<string:category>')
|
||||
def netease_comment(category=''):
|
||||
from rsshub.spiders.netease.comment import ctx
|
||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||
|
||||
@bp.route('/aisixiang/search/<string:category>/<string:keywords>')
|
||||
def aisixiang_search(category='', keywords=''):
|
||||
from rsshub.spiders.aisixiang.search import ctx
|
||||
|
||||
39
rsshub/spiders/netease/comment.py
Normal file
39
rsshub/spiders/netease/comment.py
Normal file
@@ -0,0 +1,39 @@
|
||||
from unicodedata import category
|
||||
import requests
|
||||
import json
|
||||
import arrow
|
||||
from rsshub.utils import DEFAULT_HEADERS
|
||||
|
||||
domain = 'https://comment.api.163.com/api/v1/products/a2869674571f77b5a0867c3d71db5856'
|
||||
|
||||
type = ''
|
||||
|
||||
def parse(post):
|
||||
item = {}
|
||||
item['title'] = '【原文】' + post['thread']['title'] + ' → 【跟贴】' + post['comments'][0]['1']['content']
|
||||
item['description'] = '【回帖】' + post['comments'][1]['1']['content'] if len(post['comments']) > 1 \
|
||||
else '【回帖】' + post['comments'][0]['2']['content'] if '2' in post['comments'][0] \
|
||||
else ''
|
||||
item['link'] = post['thread']['url']
|
||||
item['author'] = ''
|
||||
item['pubDate'] = arrow.now().isoformat()
|
||||
return item
|
||||
|
||||
|
||||
def ctx(category=''):
|
||||
type = category
|
||||
paths = {"heated":"/heatedList/allSite?ibc=newspc&page=1",
|
||||
"splendid":"/recommendList/single?ibc=newspc&offset=0&limit=30",
|
||||
"build":"/recommendList/build?ibc=newspc&offset=0&limit=15&showLevelThreshold=72"}
|
||||
url = domain + paths[category]
|
||||
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||
res = json.loads(res.text)
|
||||
posts = res
|
||||
items = list(map(parse, posts))
|
||||
return {
|
||||
'title': f'{category} - 网易跟贴',
|
||||
'link': "https://comment.163.com/#/" + category,
|
||||
'description': f'{category} - 网易跟贴',
|
||||
'author': 'hillerliao',
|
||||
'items': items
|
||||
}
|
||||
@@ -195,6 +195,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://pyrsshub.vercel.app/netease/comment/heated" target="_blank">https://pyrsshub.vercel.app/netease/comment/heated</a></p>
|
||||
<p class="card-text">路由:<code>/netease/comment/:category</code></p>
|
||||
<p class="card-text">参数:category [必填, heated|build|splendid]</p>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<!--item info end-->
|
||||
|
||||
<!--item info start-->
|
||||
<div class="card text-left">
|
||||
<div class="card-body">
|
||||
|
||||
Reference in New Issue
Block a user