@echo off set "myCity=beijing" set "fileUTF8=%temp%\AQI.UTF8" set "fileTMP=%temp%\AQI.TMP" set "fileANSI=%temp%\AQI.ANSI" wget -q "http://www.pm25x.com/city/%myCity%.htm" -O "%fileUTF8%" sed -r "/rt-title/!d; s#.*<b>(.*)</b>(.*)</div>#\1 \2#" "%fileUTF8%" > "%fileTMP%" sed -r "/aqivalue/!d; s#.*>(.*)</div>#[PM2.5] \1#" "%fileUTF8%" >> "%fileTMP%" sed -r "/aqileveltext/!d; s#.*>(.*)</div>#\1#" "%fileUTF8%" >> "%fileTMP%" sed "/utip/!d; s#.*utip..##; s#</div>##" "%fileUTF8%" >> "%fileTMP%" powershell -c "Get-Content ‘%fileTMP%‘ -Encoding utf8 | Out-File -Encoding default ‘%fileANSI%‘" type "%fileANSI%" pause
wget.exe sed.exe 下载地址:
http://bbs.bathome.net/s/tool/index.html
批处理查询PM2.5实时空气质量指数(AQI)
http://bbs.bathome.net/thread-38817-1-1.html
时间: 2024-10-07 01:57:52