Git Product home page Git Product logo

jiwiki's Introduction

小鸡词典

网络流行语词典,查询你不知道的那些梗或词语,适用于HoshinoBot v2

安装

  1. HoshinoBot/hoshino/modules目录clone本项目
    git clone https://github.com/zangxx66/jiwiki.git 
    
  2. HoshinoBot/hoshino/config/__bot__.py文件的MODULES_ON里添加jiwiki
  3. 重启HoshinoBot

使用方法

  • xxx是什么梗 : 查询xxx的含义
  • 小鸡词典/小鸡字典 : 查看帮助

jiwiki's People

Contributors

zangxx66 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

jiwiki's Issues

查询报错502

请问是我网络的问题吗?还是他网站的问题啊?上午还能正常用。。。
[2023-01-17 12:33:44,681 hoshino] ERROR: [Errno Expecting value]

<title>502 Bad Gateway</title>

502 Bad Gateway


nginx/1.18.0 : 0 Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 910, in json return complexjson.loads(self.text, **kwargs) File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads return _default_decoder.decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode obj, end = self.raw_decode(s) File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode return self.scan_once(s, idx=_w(s, idx).end()) simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/root/HoshinoBot/hoshino/modules/jiwiki/jiwiki.py", line 36, in query
res = await resp.json()
File "/root/HoshinoBot/hoshino/aiorequests.py", line 57, in json
return await run_sync_func(self.raw_response.json, **kwargs)
File "/root/HoshinoBot/hoshino/aiorequests.py", line 10, in run_sync_func
return await asyncio.get_event_loop().run_in_executor(
File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.8/dist-packages/requests/models.py", line 917, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: [Errno Expecting value]

<title>502 Bad Gateway</title>

502 Bad Gateway


nginx/1.18.0 : 0

请求标头缺失参数导致的查询结果异常

一个小修改,就不发pr了,开个issue讨论一下。
在我使用的过程中,查询出来的结果经常与小鸡词典网页查询出的结果不一致,并不是第一个最相关的结果。
举个例子,应该易于复现:小鸡词典网页查询cdd,抓到json中的第一个对象:

"definitions": [{
    "id": 958070346,
    "term": {
	    "id": 500490530,
	    "title": "cdd",
	    "status": "processing"
    },
    #删掉了没用的 
    "plaintext": "cdd就是臭弟弟,是指喜欢很多个人的家伙(比如我),单推的反义词\n同时也是指《BanG Dream》里户山香澄以及她的声优寺川爱美,爱美曾经说过她喜欢这个组织的原因就是因为这里有很多女人(dd本d),同时又有了「女人都是爱美的」这句话",
}]

查询结果是没问题的,titleplaintext都是第一个最相关的答案。换作插件进行查询,我log到的结果:

'definitions': [{
    'id': 855373574,
    'term': {
	    'id': 335197138,
	    'title': 'cpdd',
	    'status': 'processing'
    },
    #删掉了没用的 
    'content': '“[链接:CP]滴”滴的首字母缩写,意为“找个人组CP,有意请联系我”。常用于玩网络游戏的00后之中。\n此处的CP即couple(配对),指组成一对,发展情侣关系的意思。也有人会特地     说明,找cp只为玩游戏,既不谈感情,也不发展线下关系。[划掉:其实就是找个异性][划掉,链接:开黑]\n“滴滴”则是指互相聊天发消息/打卡/加好友(可能是因为[链接:QQ]的消息提示音是滴滴声)。代表一切“联系我”的含义。\n\n经常出现在游戏公屏,在[链接:QQ飞车]和[链接:王者荣耀]中最为常见。',
}],

可以看出用插件拿到的json顺序是乱的,第一个结果根本不是最相关的。对照浏览器发现是因为请求标头中缺失了Client: web这个参数,导致请求不完整,把这个加入到插件的header中就输出正常结果了。不过在浏览器中在上述参数下面还有一个叫Client-Version: 2.6.10r的参数,实测有没有也不影响输出,不过不太清楚会有什么影响。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.