mirror of
https://github.com/d0zingcat/RSSHub-python.git
synced 2026-05-14 15:09:23 +00:00
change website url for xuangubao
This commit is contained in:
@@ -5,26 +5,29 @@ from rsshub.utils import DEFAULT_HEADERS
|
|||||||
|
|
||||||
def parse(post):
|
def parse(post):
|
||||||
item = {}
|
item = {}
|
||||||
item['title'] = post['Title']
|
item['title'] = post['Title']
|
||||||
item['description'] = post['Summary'] if post['Summary'] != '' else post['Title']
|
item['description'] = post['Summary'] if post['Summary'] != '' \
|
||||||
item['link'] = post['OriginalUrl'] if post['OriginalUrl'] != '' else post['Url'] if post['Url'] !='' else post['ShareUrl2']
|
else post['Title']
|
||||||
item['author'] = post['Source'] + post['DisplayAuthor']
|
item['link'] = post['OriginalUrl'] if post['OriginalUrl'] != '' else \
|
||||||
|
post['Url'] if post['Url'] != '' else post['ShareUrl2']
|
||||||
|
item['author'] = post['Source'] + post['DisplayAuthor']
|
||||||
item['pubDate'] = post['CreatedAt']
|
item['pubDate'] = post['CreatedAt']
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def ctx(type='', category=''):
|
def ctx(type='', category=''):
|
||||||
api_subpath = 'bkjMsgs' if type=='theme' else 'subj'
|
api_subpath = 'bkjMsgs' if type == 'theme' else 'subj'
|
||||||
url = f'https://api.xuangubao.cn/api/pc/{api_subpath}/{category}?limit=20'
|
url = f'https://api.xuangubao.cn/api/pc/{api_subpath}/{category}?limit=20'
|
||||||
print(url)
|
print(url)
|
||||||
res = requests.get(url)
|
res = requests.get(url, headers=DEFAULT_HEADERS)
|
||||||
res = json.loads(res.text)
|
res = json.loads(res.text)
|
||||||
posts = res['Messages']
|
posts = res['Messages']
|
||||||
theme_name = res['BkjName'] if type=='theme' else res['Subject']['Title']
|
theme_name = res['BkjName'] if type == 'theme' else res['Subject']['Title']
|
||||||
items = list(map(parse, posts))
|
items = list(map(parse, posts))
|
||||||
|
sub_path = '/bkj' if type == 'theme' else ''
|
||||||
return {
|
return {
|
||||||
'title': f'{theme_name} - 主题 - 选股宝',
|
'title': f'{theme_name} - 主题 - 选股宝',
|
||||||
'link': f'https://xuangubao.cn/subject/bkj/{category}',
|
'link': f'https://xuangubao.cn/subject{sub_path}/{category}',
|
||||||
'description': f'{theme_name} 板块/主题动态 - 选股宝',
|
'description': f'{theme_name} 板块/主题动态 - 选股宝',
|
||||||
'author': 'hillerliao',
|
'author': 'hillerliao',
|
||||||
'items': items
|
'items': items
|
||||||
|
|||||||
Reference in New Issue
Block a user