From c714a1f860bb5ccfd3b80228c9e53b4289e47a2a Mon Sep 17 00:00:00 2001 From: SiHuan Date: Mon, 16 Mar 2020 16:47:54 +0800 Subject: [PATCH] pixiv --- .gitignore | 1 + worker/pixiv.py | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 worker/pixiv.py diff --git a/.gitignore b/.gitignore index 05cc0cf..1dc8a82 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ env __pycache__ .vscode +config.py \ No newline at end of file diff --git a/worker/pixiv.py b/worker/pixiv.py new file mode 100644 index 0000000..7a9cbc2 --- /dev/null +++ b/worker/pixiv.py @@ -0,0 +1,32 @@ +from zzcore import StdAns +import requests + +class Ans(StdAns): + AllowGroup = [959613860] + def GETMSG(self): + url = 'https://api.lolicon.app/setu/' + params = { + 'apikey': '095536795e6f0715593173', + } + + if len(self.parms) < 2: + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = picurl + except Exception as e: + print(e) + msg = '什么东西坏掉了,大概是Pixiv吧...不可能是咱!' + return msg + + else: + keyword = self.raw_msg['message'][7:] + params['keyword'] = keyword + try: + resp = requests.get(url=url,params=params).json() + picurl = resp['data'][0]['url'] + msg = picurl + except Exception as e: + print(e) + msg = '咱没查到,也有可能是Pixiv坏掉了' + return msg \ No newline at end of file