moji

news/2024/11/15 22:22:48/文章来源:https://www.cnblogs.com/gnz48/p/18548752

h5ctywhr.api.moji.com/fc40

https://h5ctywhr.api.moji.com/weatherDetail

{"cityId":"280000","cityType":0}: 

 

/*城市搜索*/
var searchBaseUrl = "https://ssch.api.moji.com/citymanage/json/h5/searchCity";

'keyWord': cityName

/**城市列表 */
var cityListBase = "https://h5ctywhr.api.moji.com/weatherthird/cityList";
/**省对应城市id接口 */
var mapCityBase = "https://h5ctywhr.api.moji.com/weatherthird/provincialList";
/**预警列表接口 */
var alertBase = "https://h5ctywhr.api.moji.com/weatherthird/alertPage";
/**首页预警接口*/
var alertIndexBase = "https://h5ctywhr.api.moji.com/weatherthird/alert";

{"aqi":{"desc":"优","level":1,"value":16},"cityId":280000,"cityName":"深圳市龙华区","code":0,"condition":{"humidity":94,"icon":31,"mslp":0,"pressure":0,"realFeel":26,"temp":23,"tips":"","updateTime":1731675249,"weather":"多云","weatherId":82,"windDir":"北风","windLevel":2,"wspd":2.31},"countryName":"中国","forecastDays":{"forecastDay":[{"aqiDesc":"优","aqiLevel":1,"aqiValue":16,"festival":"","humidity":89,"iconDay":3,"iconNight":33,"predictDate":1731513600,"realFeel":0,"sunDown":1731577200,"sunRise":1731537360,"tempHigh":26,"tempLow":23,"weatherDay":"阵雨","weatherNight":"阵雨","weatherType":0,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"3","windLevelNight":"2","wspdDay":4.4,"wspdNight":2.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":19,"festival":"","humidity":85,"iconDay":8,"iconNight":33,"predictDate":1731600000,"realFeel":0,"sunDown":1731663600,"sunRise":1731623820,"tempHigh":27,"tempLow":23,"weatherDay":"中雨","weatherNight":"阵雨","weatherType":2,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"1","windLevelNight":"1","wspdDay":0.9,"wspdNight":0.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":37,"festival":"","humidity":79,"iconDay":1,"iconNight":31,"predictDate":1731686400,"realFeel":0,"sunDown":1731750000,"sunRise":1731710280,"tempHigh":30,"tempLow":23,"weatherDay":"多云","weatherNight":"多云","weatherType":0,"windDirDay":"西北风","windDirNight":"东北风","windLevelDay":"2","windLevelNight":"2","wspdDay":2.4,"wspdNight":2.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":43,"festival":"","humidity":74,"iconDay":3,"iconNight":31,"predictDate":1731772800,"realFeel":0,"sunDown":1731836340,"sunRise":1731796680,"tempHigh":28,"tempLow":22,"weatherDay":"阵雨","weatherNight":"多云","weatherType":2,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"2","windLevelNight":"2","wspdDay":2.4,"wspdNight":2.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":36,"festival":"","humidity":64,"iconDay":1,"iconNight":33,"predictDate":1731859200,"realFeel":0,"sunDown":1731922740,"sunRise":1731883140,"tempHigh":27,"tempLow":19,"weatherDay":"多云","weatherNight":"阵雨","weatherType":2,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"2","windLevelNight":"2","wspdDay":2.4,"wspdNight":2.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"festival":"","humidity":62,"iconDay":1,"iconNight":7,"predictDate":1731945600,"realFeel":0,"sunDown":1732009140,"sunRise":1731969600,"tempHigh":22,"tempLow":18,"weatherDay":"多云","weatherNight":"小雨","weatherType":2,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"3","windLevelNight":"2","wspdDay":4.4,"wspdNight":2.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":28,"festival":"","humidity":65,"iconDay":7,"iconNight":7,"predictDate":1732032000,"realFeel":0,"sunDown":1732095540,"sunRise":1732056000,"tempHigh":21,"tempLow":17,"weatherDay":"小雨","weatherNight":"小雨","weatherType":2,"windDirDay":"东北风","windDirNight":"东北风","windLevelDay":"2","windLevelNight":"2","wspdDay":2.4,"wspdNight":2.4}],"forecastDay40":{"fallTrendDesc":[{"briefDesc":"6天降水","desc":"预计未来40天将出现6天降雨","type":2}],"tempTrendDesc":[{"desc":"预计未来40天平均最高温为22℃","type":3}]}},"forecastHours":{"forecastHour":[{"aqiDesc":"优","aqiLevel":1,"aqiValue":21,"humidity":94,"icon":31,"predictTime":1731675600,"pressure":0,"realFeel":29,"temp":23,"uvi":"1","weather":"多云","windDesc":"旋转风","windDir":"N","windLevel":"2","wspd":2.31},{"aqiDesc":"优","aqiLevel":1,"aqiValue":23,"humidity":96,"icon":31,"predictTime":1731679200,"pressure":0,"realFeel":29,"temp":24,"uvi":"1","weather":"多云","windDesc":"西南风","windDir":"SSW","windLevel":"1","wspd":0.8},{"aqiDesc":"优","aqiLevel":1,"aqiValue":25,"humidity":96,"icon":31,"predictTime":1731682800,"pressure":0,"realFeel":29,"temp":25,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"WNW","windLevel":"1","wspd":0.8},{"aqiDesc":"优","aqiLevel":1,"aqiValue":27,"humidity":94,"icon":31,"predictTime":1731686400,"pressure":0,"realFeel":29,"temp":24,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"1","wspd":0.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":30,"humidity":92,"icon":31,"predictTime":1731690000,"pressure":0,"realFeel":28,"temp":24,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"WNW","windLevel":"1","wspd":1.0},{"aqiDesc":"优","aqiLevel":1,"aqiValue":32,"humidity":91,"icon":31,"predictTime":1731693600,"pressure":0,"realFeel":28,"temp":24,"uvi":"1","weather":"少云","windDesc":"西北风","windDir":"WNW","windLevel":"1","wspd":0.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":33,"humidity":90,"icon":31,"predictTime":1731697200,"pressure":0,"realFeel":28,"temp":24,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"1","wspd":0.8},{"aqiDesc":"优","aqiLevel":1,"aqiValue":33,"humidity":90,"icon":31,"predictTime":1731700800,"pressure":0,"realFeel":27,"temp":23,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"1","wspd":1.1},{"aqiDesc":"优","aqiLevel":1,"aqiValue":33,"humidity":89,"icon":31,"predictTime":1731704400,"pressure":0,"realFeel":27,"temp":23,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"NNW","windLevel":"1","wspd":1.1},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"humidity":94,"icon":31,"predictTime":1731708000,"pressure":0,"realFeel":28,"temp":23,"uvi":"1","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"1","wspd":0.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"humidity":90,"icon":1,"predictTime":1731711600,"pressure":0,"realFeel":28,"temp":24,"uvi":"1","weather":"多云","windDesc":"旋转风","windDir":"N","windLevel":"1","wspd":0.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"humidity":86,"icon":1,"predictTime":1731715200,"pressure":0,"realFeel":28,"temp":23,"uvi":"1","weather":"多云","windDesc":"东北风","windDir":"NNE","windLevel":"1","wspd":1.0},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"humidity":82,"icon":1,"predictTime":1731718800,"pressure":0,"realFeel":29,"temp":25,"uvi":"2","weather":"少云","windDesc":"东北风","windDir":"NNE","windLevel":"1","wspd":1.1},{"aqiDesc":"优","aqiLevel":1,"aqiValue":34,"humidity":76,"icon":1,"predictTime":1731722400,"pressure":0,"realFeel":29,"temp":28,"uvi":"3","weather":"多云","windDesc":"西北风","windDir":"WNW","windLevel":"1","wspd":1.5},{"aqiDesc":"优","aqiLevel":1,"aqiValue":35,"humidity":73,"icon":1,"predictTime":1731726000,"pressure":0,"realFeel":30,"temp":30,"uvi":"4","weather":"多云","windDesc":"西北风","windDir":"WNW","windLevel":"2","wspd":1.7},{"aqiDesc":"优","aqiLevel":1,"aqiValue":36,"humidity":69,"icon":1,"predictTime":1731729600,"pressure":0,"realFeel":32,"temp":30,"uvi":"4","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"2","wspd":1.9},{"aqiDesc":"优","aqiLevel":1,"aqiValue":37,"humidity":66,"icon":1,"predictTime":1731733200,"pressure":0,"realFeel":32,"temp":29,"uvi":"4","weather":"多云","windDesc":"西北风","windDir":"NW","windLevel":"2","wspd":2.0},{"aqiDesc":"优","aqiLevel":1,"aqiValue":38,"humidity":62,"icon":1,"predictTime":1731736800,"pressure":0,"realFeel":32,"temp":29,"uvi":"3","weather":"多云","windDesc":"西北风","windDir":"WNW","windLevel":"2","wspd":1.8},{"aqiDesc":"优","aqiLevel":1,"aqiValue":38,"humidity":63,"icon":3,"predictTime":1731740400,"pressure":0,"realFeel":32,"temp":29,"uvi":"2","weather":"阵雨","windDesc":"西北风","windDir":"WNW","windLevel":"2","wspd":1.7},{"aqiDesc":"优","aqiLevel":1,"aqiValue":39,"humidity":65,"icon":3,"predictTime":1731744000,"pressure":0,"realFeel":31,"temp":29,"uvi":"1","weather":"阵雨","windDesc":"东北风","windDir":"NNE","windLevel":"2","wspd":1.6},{"aqiDesc":"优","aqiLevel":1,"aqiValue":40,"humidity":67,"icon":1,"predictTime":1731747600,"pressure":0,"realFeel":30,"temp":28,"uvi":"1","weather":"多云","windDesc":"东北风","windDir":"NE","windLevel":"2","wspd":1.6},{"aqiDesc":"优","aqiLevel":1,"aqiValue":42,"humidity":70,"icon":31,"predictTime":1731751200,"pressure":0,"realFeel":29,"temp":28,"uvi":"1","weather":"多云","windDesc":"东北风","windDir":"NE","windLevel":"1","wspd":1.4},{"aqiDesc":"优","aqiLevel":1,"aqiValue":43,"humidity":72,"icon":31,"predictTime":1731754800,"pressure":0,"realFeel":28,"temp":28,"uvi":"1","weather":"多云","windDesc":"东北风","windDir":"NE","windLevel":"1","wspd":1.2},{"aqiDesc":"优","aqiLevel":1,"aqiValue":45,"humidity":31,"icon":30,"predictTime":1731758400,"pressure":0,"realFeel":29,"temp":28,"uvi":"1","weather":"晴","windDesc":"东北风","windDir":"NE","windLevel":"1","wspd":1.0}]},"lat":22.724442,"lon":114.055193,"provinceName":"广东省","rc":{"c":0},"timezone":8}
def get_city_weather(cityId):url='https://h5ctywhr.api.moji.com/weatherDetail'headers={'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'}data={"cityId":cityId,"cityType":0}r=requests.post(url,headers=headers,json=data)result=r.json()# today forecastforecastToday=dict(humidity=f"{result['condition']['humidity']}%",temp=f"{result['condition']['temp']}°C",realFeel=f"{result['condition']['realFeel']}°C",weather=result['condition']['weather'],wind=f"{result['condition']['windDir']}{result['condition']['windLevel']}级",updateTime=(datetime.datetime.fromtimestamp(result['condition']['updateTime'])+datetime.timedelta(hours=8)).strftime('%H:%M:%S'))# 24 hours forecastforecastHours=[]for i in result['forecastHours']['forecastHour']:tmp={}tmp['PredictTime']=(datetime.datetime.fromtimestamp(i['predictTime'])+datetime.timedelta(hours=8)).strftime('%H:%M')tmp['Temperature']=i['temp']tmp['Body Temperature']=i['realFeel']tmp['Humidity']=i['humidity']tmp['Weather']=i['weather']tmp['Wind']=f"{i['windDesc']}{i['windLevel']}级"forecastHours.append(tmp)df_forecastHours=pd.DataFrame(forecastHours).set_index('PredictTime')# 7 days forecastforecastDays=[]day_format={1:'昨天',0:'今天',-1:'明天',-2:'后天'}for i in result['forecastDays']['forecastDay']:tmp={}now=datetime.datetime.fromtimestamp(i['predictDate'])+datetime.timedelta(hours=8)diff=(st.session_state.date_time-now).daysfestival=i['festival']tmp['PredictDate']=(day_format[diff] if diff in day_format else now.strftime('%m/%d')) + (f' {festival}' if festival != '' else '')tmp['Temperature']=f"{i['tempLow']}~{i['tempHigh']}°C"tmp['Humidity']=f"{i['humidity']}%"tmp['WeatherDay']=i['weatherDay']tmp['WeatherNight']=i['weatherNight']tmp['WindDay']=f"{i['windDirDay']}{i['windLevelDay']}级"tmp['WindNight']=f"{i['windDirNight']}{i['windLevelNight']}级"forecastDays.append(tmp)df_forecastDays=pd.DataFrame(forecastDays).set_index('PredictDate')return forecastToday,df_forecastHours,df_forecastDays
def get_sky(cityName):url = 'https://ssch.api.moji.com/citymanage/json/h5/searchCity'data = {'keyWord': cityName}res = requests.post(url, data=data)try:cityId = res.json()['city_list'][0]['cityId']except:return 'cty_name error'url = 'https://h5ctywhr.api.moji.com/weatherDetail'data = {"cityId": cityId, "cityType": 0}res = requests.post(url, json=data)obj = res.json()temp = obj['condition']['temp']humidity = obj['condition']['humidity']weather = obj['condition']['weather']wind = obj['condition']['windDir'] + ' ' + str(obj['condition']['windLevel']) + '级'tips = obj['condition']['tips']city = f"{obj['provinceName']}-{obj['cityName']}"return f'''地区:{city}
温度:{temp} 湿度:{humidity}
天气:{weather} 风向:{wind}
提示:{tips}'''
public static List<AlertPO> queryAlert(Integer cityId) {try {Map<String, Object> paramMap = new HashMap<>();String url = "https://h5ctywhr.api.moji.com/weatherthird/alert";paramMap.put("cityId", cityId);String jsonString = JSON.toJSONString(paramMap);String result = HttpUtil.post(url, jsonString);JSONObject jsonObject = JSON.parseObject(result);List<AlertPO> resultList = new ArrayList<>();JSONArray alert = jsonObject.getJSONArray("alert");if (alert == null) {return null;}for (Object o : alert) {JSONObject item = (JSONObject) o;AlertPO build = AlertPO.builder().alertType(item.getInteger("alertTypeId")).level(item.getInteger("level")).content(item.getString("content")).publishTime(item.getLong("publishTime")).reliveTime(item.getLong("reliveTime")).publishSector(item.getString("publishSector")).name(item.getString("name")).build();resultList.add(build);}return resultList;} catch (Exception e) {log.error("获取预警信息失败 ! cityId {}", cityId);log.error("", e);}return null;}public static void main(String[] args) {queryAlert(2543);}
}

 

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.hqwc.cn/news/834275.html

如若内容造成侵权/违法违规/事实不符,请联系编程知识网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Latex 安装

使用的开发环境是 VSCode. Latex 在编译时需要用到宏包. 宏包到底是啥? 有啥作用? 从何处下载? Latex 软件的安装:texlive: 一次性下载所有的宏包. 磁盘需求较大, 约 7 ~ 8 G.miktex: 仅下载必要的宏包, 编译时补充下载宏包. 磁盘需求较小, 约几百 M.清华大学开源软件镜像站…

20222424 2024-2025-1 《网络与系统攻防技术》实验五实验报告

20222424 2024-2025-1 《网络与系统攻防技术》实验五实验报告 1.实验内容 (1)从www.besti.edu.cn、baidu.com、sina.com.cn中选择一个DNS域名进行查询,获取如下信息:DNS注册人及联系方式 该域名对应IP地址 IP地址注册人及联系方式 IP地址所在国家、城市和具体地理位置 PS:…

Windows程序设计指南

Windows程序设计指南“到Petzold的书中找找”——仍然是解决Windows程式开发各种疑难杂症时的灵丹妙药。在第五版的《Windows程式开发设计指南》中,作者身为倍受敬重的WindowsPioneerAward(Windows开路先锋奖)得主,依据最新版本Windows作业系统,以可靠的取材资料校定这一本…

Windows高级调试

Windows高级调试中文版文档摘要: 本书《Windows高级调试》主要讲解Windows高级调试技术和工具,包括调试器简介、调试器揭密、符号文件与源文件的管理、栈内存破坏、堆内存破坏、安全、进程间通信、资源泄漏、同步、编写定制的调试扩展、64位调试、事后调试、Windows Vista基础…

iman——冲刺日志(第四天)

又一阉割版 团队成员分工与进度 📝👥组别 成员 完成的任务 完成任务所用时间 (小时) 剩余时间 (小时)前端 阿依娜孜 完成了行程概览地图中标记连线与探索功能的删除与添加。 3 2前端 郭剑敏 实现了地图标点的驾车路线绘制功能。 3 1前端 王梓铭 优化了主页与导航栏布局,提…

1.11--06:月度开销

http://noi.openjudge.cn/ch0111/06/月度开销题目传送门思路 给定连续N天的开销,需要将这些天分成M个财政周期,使得开销最多的财政周期的开销尽可能少。 首先,我们可以确定一个财政周期的长度l,即将N天平均分成M个财政周期。这样每个财政周期的长度就是N/M。 然后,我们需要…

SIM Jacker攻击分析

攻击者使用普通手机发送特殊构造的短信即可远程定位目标,危害较大。sim卡的使用在手机上的使用非常普遍,所以一旦SIM卡上出现什么问题就会造成非常大的影响。在19年的报告纰漏中,在全球估算共有10亿设备的sim卡容易遭受SIMJacker攻击,这篇也是比较浅显的对整个攻击进行分析…

shell动态修改yml配置实例

yq安装https://github.com/mikefarah/yq/tree/master每个yq版本支持的选项参数都不一样修改Dockerfile[root@instance base-tlog-test]# vi Dockerfile FROM 192.168.30.113/library/java:latest ENV TZ=Asia/Shanghai RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime &am…

『模拟赛』NOIP2024加赛5

Rank 反向挂分大王A. 暴力操作(opt) 签,但是没有人签。 都想到了二分和更新 c 值,但是 c 多多少少没更到最优。 首先还是调和级数预处理,倒序取 min。然后考虑到超过 \(m\) 的也有可能产生更小的代价,因此 \(\mathcal{O(n)}\) 枚举一遍找到最小的 \(j\) 使 \(i\times j\g…

[Moectf2024 ezMaze]

去壳 分析:迷宫分析10 * a2 - 10:Y (a1 - 1) / 8 :X 表示按字节处理迷宫迷宫以十六进制压缩,但迷宫是80 * 56的二进制迷宫 dump下来保存,转二进制,用bin(maze[2:]).zfill(8) 脚本(bfs): from collections import deque maze = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1…

有理逼近AAA算法

用于有理逼近的AAA算法,可以有效防止伪极点现象用于有理逼近的AAA算法The AAA Algorithm for Rational Approximation, Yuji Nakatsukasa, Olivier Ste, and Lloyd N. Trefethen, SIAM Journal on Scientific Computing 2018 40:3, A1494-A1522, https://doi.org/10.1137/16M1…

Hgame2023 Reverse

Hgame 2023 [HGAME 2023 week1]test your IDA 用ida打开即可 [HGAME 2023 week1]encode 查壳 32位windows 加密函数将输入的字节转高位和低位进行加密,后与byte_403000进行比较 解密脚本: 这里采取了爆破 enc = [8, 6, 7, 6, 1, 6, 13, 6, 5, 6, 11, 7, 5, 6, 14, 6, 3, 6, 1…