From 1a514c543eaa65a2ca74f060b36eaeb80c909e15 Mon Sep 17 00:00:00 2001 From: liyp Date: Sat, 13 Nov 2021 20:07:24 +0800 Subject: [PATCH] =?UTF-8?q?icp=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- worker/icp.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/worker/icp.py b/worker/icp.py index 9345318..8f4d489 100644 --- a/worker/icp.py +++ b/worker/icp.py @@ -4,22 +4,24 @@ import requests class Ans(StdAns): def GETMSG(self): - # print('https://api.devopsclub.cn/api/icpquery?url=' + self.parms[1]) - r = requests.get(url='https://api.devopsclub.cn/api/icpquery?url=' + self.parms[1]).json() - if r['code'] == 0: - organizer_name = r['data']['organizer_name'] - organizer_nature = r['data']['organizer_nature'] - recording_license_number = r['data']['recording_license_number'] - site_name = r['data']['site_name'] - if r['data']['site_index_url'] == '': + r = requests.get(url='https://api.oick.cn/icp/api.php?url=' + str(self.parms[1]).lower()).json() + if r['code'] == '200': + organizer_name = r['主办单位名称'] + organizer_nature = r['主办单位性质'] + recording_license_number = r['网站备案/许可证号'] + site_name = r['网站名称'] + if r['网站首页网址'] == '': site_index_url = '' else: - site_index_url = '网站首页地址:' + r['data']['site_index_url'] + site_index_url = '网站首页地址:' + r['网站首页网址'] msg = '主办单位名称:' + organizer_name + '\n' + \ '主办单位性质:' + organizer_nature + '\n' + \ '网站备案/许可证号:' + recording_license_number + '\n' + \ '网站名称:' + site_name + '\n' + \ site_index_url - else: - msg = '可能是查询接口坏掉了,可不是咱!' + + elif r['code'] == 201: + msg = '未有此域名ICP备案记录!' + elif r['code'] == 202: + msg = '域名不能为空!' return msg