From 845fd7231799351b4f92996ae1586536833592b4 Mon Sep 17 00:00:00 2001 From: hillerliao Date: Sun, 8 May 2022 20:24:45 +0800 Subject: [PATCH] set chouti item url to original url --- rsshub/spiders/chouti/search.py | 1 - rsshub/spiders/chouti/section.py | 10 +++++----- rsshub/spiders/chouti/user.py | 8 +++++--- rsshub/templates/main/feeds.html | 2 +- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/rsshub/spiders/chouti/search.py b/rsshub/spiders/chouti/search.py index e1882a4..c30f0d8 100644 --- a/rsshub/spiders/chouti/search.py +++ b/rsshub/spiders/chouti/search.py @@ -10,7 +10,6 @@ def parse(post): item['title'] = re.sub(r'<[^>]*>', '', post['title']).strip() chouti_link = domain + '/link/' + str(post['id']) item['description'] = post['title'] + '

' + f'抽屉链接' - item['link'] = post['originalUrl'] item['pubDate'] = str(post['created_time'])[0:10] item['author'] = post['submitted_user']['nick'] diff --git a/rsshub/spiders/chouti/section.py b/rsshub/spiders/chouti/section.py index 2fef3fc..a50bb11 100644 --- a/rsshub/spiders/chouti/section.py +++ b/rsshub/spiders/chouti/section.py @@ -1,19 +1,19 @@ +import re 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['title'] = re.sub(r'<[^>]*>', '', post['title']).strip() + chouti_link = domain + '/link/' + str(post['id']) + item['description'] = post['title'] + '

' + f'抽屉链接' + item['link'] = post['originalUrl'] item['pubDate'] = str(post['created_time'])[0:10] item['author'] = post['submitted_user']['nick'] return item - def ctx(category=''): DEFAULT_HEADERS.update({'Referer': domain}) post_data = {'sectionId':category} diff --git a/rsshub/spiders/chouti/user.py b/rsshub/spiders/chouti/user.py index 264eaaa..70b9a8b 100644 --- a/rsshub/spiders/chouti/user.py +++ b/rsshub/spiders/chouti/user.py @@ -1,3 +1,4 @@ +import re import requests from rsshub.utils import DEFAULT_HEADERS @@ -6,9 +7,10 @@ domain = 'https://dig.chouti.com' def parse(post): item = {} - item['title'] = post['title'] - item['description'] = f"{item['title']} " - item['link'] = 'https://dig.chouti.com/link/' + str(post['id']) + item['title'] = re.sub(r'<[^>]*>', '', post['title']).strip() + chouti_link = domain + '/link/' + str(post['id']) + item['description'] = post['title'] + '

' + f'抽屉链接' + item['link'] = post['originalUrl'] item['pubDate'] = str(post['created_time'])[0:10] item['author'] = post['submitted_user']['nick'] return item diff --git a/rsshub/templates/main/feeds.html b/rsshub/templates/main/feeds.html index ed07566..10d1110 100644 --- a/rsshub/templates/main/feeds.html +++ b/rsshub/templates/main/feeds.html @@ -321,7 +321,7 @@

抽屉新热榜 - 用户

抽屉新热榜 - 用户 by hillerliao
-

举例:https://rsshub.deta.dev/chouti/user/61675332140

+

举例:https://rsshub.deta.dev/chouti/user/wb_5517143496

路由:/chouti/user/:category

参数:category [必填, 用户id]