介绍


一同学来刷屏,于是花了一会儿直接写出了个全自动的工具。

原理

获取网络上的API的内容,复制到剪贴板,打开QQ界面,粘贴,发送

源码

可能更新不及时:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import requests
import os
import time
import pyautogui, sys
import win32gui
# 请选择(输入数字选择):1、一言;2、毒鸡汤(搏天);3、诗句(一句)
x = 3
num = 1
# 窗口名
hld = win32gui.FindWindow(None, u"XXXXXXXXXXXXX")
win32gui.SetForegroundWindow(hld)
# 条数
while num <= 50:
time.sleep(0.5)
# 一言
o = str(requests.get('https://v1.hitokoto.cn/').json()['hitokoto'])
# 毒鸡汤
p = str(requests.get(
'https://api.btstu.cn/yan/api.php?charset=utf-8&encode=json').json()['text'])
# 诗句
s = str(requests.get(
'http://yijuzhan.com/api/word.php?m=json').json()['content'])
if x == 1:
bbb = o
if x == 2:
bbb = p
if x == 3:
bbb = s
def addToClipBoard(text):
command = 'echo ' + text.strip() + '| clip'
os.system(command)
addToClipBoard(bbb)
num = num + 1
pyautogui.hotkey('ctrl', 'v')
pyautogui . hotkey('ctrl', 'enter')

GitHub仓库:https://github.com/wayne0926/shuaping

鸣谢

1、一言网的一句话(简体) https://hitokoto.cn/

2、搏天api的随机语录(简体) https://api.btstu.cn/

3、一句网(简体) https://yijuzhan.com/