mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-06-01 15:10:14 +00:00
add chouti user
This commit is contained in:
@@ -175,6 +175,11 @@ def chouti_search(category=''):
|
|||||||
from rsshub.spiders.chouti.search import ctx
|
from rsshub.spiders.chouti.search import ctx
|
||||||
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
|
@bp.route('/chouti/user/<string:category>')
|
||||||
|
def chouti_user(category=''):
|
||||||
|
from rsshub.spiders.chouti.user import ctx
|
||||||
|
return render_template('main/atom.xml', **filter_content(ctx(category)))
|
||||||
|
|
||||||
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
@bp.route('/mp/tag/<string:mp>/<string:tag>')
|
||||||
def mp_tag(mp='', tag=''):
|
def mp_tag(mp='', tag=''):
|
||||||
from rsshub.spiders.mp.tag import ctx
|
from rsshub.spiders.mp.tag import ctx
|
||||||
|
|||||||
28
rsshub/spiders/chouti/user.py
Normal file
28
rsshub/spiders/chouti/user.py
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
import requests
|
||||||
|
from rsshub.utils import DEFAULT_HEADERS
|
||||||
|
|
||||||
|
domain = 'https://dig.chouti.com'
|
||||||
|
|
||||||
|
|
||||||
|
def parse(post):
|
||||||
|
item = {}
|
||||||
|
item['title'] = post['title']
|
||||||
|
item['description'] = f"[{post['sectionName']}] {item['title']} "
|
||||||
|
item['link'] = 'https://dig.chouti.com/link/' + str(post['id'])
|
||||||
|
item['pubDate'] = str(post['created_time'])[0:10]
|
||||||
|
item['author'] = post['submitted_user']['nick']
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
|
def ctx(category=''):
|
||||||
|
DEFAULT_HEADERS.update({'Referer': domain})
|
||||||
|
r_url = f'{domain}/publish/links/ajax?userId=ctu_{category}'
|
||||||
|
posts = requests.get(r_url, headers=DEFAULT_HEADERS).json()['data']
|
||||||
|
user_name = posts[0]['submitted_user']['nick']
|
||||||
|
return {
|
||||||
|
'title': f'{user_name} - 个人主页 - 抽屉热榜',
|
||||||
|
'link': f'{domain}/publish/links/ctu_{category}',
|
||||||
|
'description': f'{user_name} - 个人主页 - 抽屉热榜',
|
||||||
|
'author': 'hillerliao',
|
||||||
|
'items': list(map(parse, posts))
|
||||||
|
}
|
||||||
@@ -295,6 +295,19 @@
|
|||||||
<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/chouti/user/61675332140" target="_blank">https://pyrsshub.herokuapp.com/chouti/user/61675332140</a></p>
|
||||||
|
<p class="card-text">路由:<code>/chouti/user/:category</code></p>
|
||||||
|
<p class="card-text">参数:category [必填, 用户id] </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