// ==UserScript== // @name 疫情查询助手 // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.1.1 // @description 每天9点-23:59之间运行一次,获取地区疫情信息 // @author 张仨 // @crontab * 9-23 once * * // @grant GM_xmlhttpRequest // @grant GM_notification // @grant GM_getValue // @connect api.iyk0.com // ==/UserScript== /* ==UserConfig== 配置: city: title: 输入想要查询的城市名称! description: 地区信息 default: ==/UserConfig== */ return new Promise((resolve, reject) => { let region = GM_getValue("配置.city") || "北京"; GM_xmlhttpRequest({ method: "GET", responseType: "json", url: "https://api.iyk0.com/yq/?msg=" + region, onload: function (xhr) { if (xhr.response.code === 200) { let time = xhr.response.time let city = xhr.response.查询地区 let new_diagnosis = xhr.response.新增确诊 let existing_diagnosis = xhr.response.现存确诊 let existing_asymptomatic = xhr.response.现存无症状 let currently_diagnosed = xhr.response.目前确诊 let cure = xhr.response.治愈人数 let death = xhr.response.死亡人数 GM_notification({ title: "地区疫情查询", image: "https://inews.gtimg.com/newsapp_ls/0/14559792196/0.png", text: `时间:${time} 地区:${city} \n新增确诊:${new_diagnosis} 人 现存确诊:${existing_diagnosis} 人 \n目前确诊:${currently_diagnosed} 人 现存无症状:${existing_asymptomatic} 人 \n治愈人数:${cure} 人 死亡人数:${death} 人` }) resolve(); } else { GM_notification("数据获取失败,请修改城市名称!") resolve(); } } }) });