优化搜索结果
This commit is contained in:
parent
47ef41636f
commit
949cc00d2a
1 changed files with 5 additions and 2 deletions
|
@ -72,14 +72,17 @@ class Ans(StdAns):
|
||||||
req = requests.get(
|
req = requests.get(
|
||||||
url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json()
|
url='https://archlinux.org/packages/search/json/?name=' + self.parms[1] + '&arch=x86_64').json()
|
||||||
if req['results'] == []:
|
if req['results'] == []:
|
||||||
req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=search&arg=' + self.parms[1]).json()
|
req = requests.get(url='https://aur.archlinux.org/rpc/?v=5&type=info&arg=' + self.parms[1]).json()
|
||||||
# print(req)
|
# print(req)
|
||||||
if req['resultcount'] > 0:
|
if req['resultcount'] > 0:
|
||||||
name = '包名:' + req['results'][0]['Name']
|
name = '包名:' + req['results'][0]['Name']
|
||||||
# pkgname = req['results'][0]['pkgname']
|
# pkgname = req['results'][0]['pkgname']
|
||||||
version = '版本:' + req['results'][0]['Version']
|
version = '版本:' + req['results'][0]['Version']
|
||||||
description = '描述:' + req['results'][0]['Description']
|
description = '描述:' + req['results'][0]['Description']
|
||||||
maintainer = '维护:' + req['results'][0]['Maintainer']
|
if req['results'][0]['Maintainer'] is None:
|
||||||
|
maintainer=''
|
||||||
|
else:
|
||||||
|
maintainer = '维护:' + req['results'][0]['Maintainer']
|
||||||
numvotes = '投票:' + str(req['results'][0]['NumVotes'])
|
numvotes = '投票:' + str(req['results'][0]['NumVotes'])
|
||||||
updatetime = req['results'][0]['LastModified']
|
updatetime = req['results'][0]['LastModified']
|
||||||
updatetime = time.localtime(int(updatetime))
|
updatetime = time.localtime(int(updatetime))
|
||||||
|
|
Loading…
Reference in a new issue