#!/bin/bash
#read -p "请输入您想和小young说的话:" input
#curl -G -d "key=abda91b36e4943daa38ed8af41eae833&info=$input" http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2
# {"code":100000,"text":"嘿嘿,你脸红了啊"} cat 1 |cut -d ":" -f3|cut -d '"' -f2
while [[ true ]]; do
read -p "请输入您想和小young说的话:" input
curl -G -d "key=这里输入您申请的KEY&info=$input" -s http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2
done
附上截图;
那是之前的版本 现在附上改进后的版本,
#!/bin/bash
#read -p "请输入您想和小young说的话:" input
#curl -G -d "key=abda91b36e4943daa38ed8af41eae833&info=$input" http://www.tuling123.com/openapi/api |cut -d ":" -f3|cut -d '"' -f2
# {"code":100000,"text":"嘿嘿,你脸红了啊"} cat 1 |cut -d ":" -f3|cut -d '"' -f2
#jq 是一个截取json的命令 wget http://stedolan.github.io/jq/download/linux64/jq
export LANG=zh_CN.UTF-8
while [[ true ]]; do
read -p "请输入您想和小young说的话:" i
curl -H "Content-Type: application/json" -X POST -d '{"key":"abda91b36e4943daa38ed8af41eae833","info":"'"${i}"'"}' -s http://www.tuling123.com/openapi/api |jq '.'|grep -v -E "{|}"
done