-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathweather.sh
9 lines (5 loc) · 2.83 KB
/
weather.sh
1
2
3
4
5
6
7
8
9
export DATE=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].casts[0].date") && curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'"今天是${DATE}"'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/21980b82-3c60-4636-b6d2-04a7822a0185
export WEATHER=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].casts[0].dayweather") && curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'"天气为${WEATHER}"'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/21980b82-3c60-4636-b6d2-04a7822a0185
export DAYTEMP=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].casts[0].daytemp") && curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'"最高温度为${DAYTEMP}度"'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/21980b82-3c60-4636-b6d2-04a7822a0185
export NIGHTTEMP=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].casts[0].nighttemp") && curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'"最低温度为${NIGHTTEMP}度"'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/21980b82-3c60-4636-b6d2-04a7822a0185
export WEATHER=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].casts[0].dayweather") && export CITY=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].city") && export PROVINCE=$(curl --location --request GET 'https://restapi.amap.com/v3/weather/weatherInfo?city=310115&extensions=all&key=0bc071f5abc975921df3827947ae479a' --header 'User-Agent: apifox/1.0.0 (https://www.apifox.cn)' | jq -r ".forecasts[].province") && curl -X POST -H "Content-Type: application/json" -d '{"msg_type":"text","content":{"text":"'"${PROVINCE}市${CITY}今天天气为${WEATHER}"'"}}' https://open.feishu.cn/open-apis/bot/v2/hook/21980b82-3c60-4636-b6d2-04a7822a0185