Skip to content

Instantly share code, notes, and snippets.

@NeuroWhAI
Created August 5, 2020 13:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NeuroWhAI/942ac11562163521b6bc1fd3b0abf70f to your computer and use it in GitHub Desktop.
Save NeuroWhAI/942ac11562163521b6bc1fd3b0abf70f to your computer and use it in GitHub Desktop.
날씨누리 레이더 영상 크롤링
import urllib.request
from datetime import datetime, timedelta
import time
tm = datetime(2020, 8, 5, 22, 00) # 이 시점부터 과거로 가면서 얻음.
while True:
tm_str = tm.strftime("%Y%m%d%H%M")
url = f"https://www.weather.go.kr/w/cgi-bin/rdr_new/nph-rdr_sat_lgt_img_v3?tm={tm_str}&sat=ir1&rdr=lng&map=HC&size=640&zoom_level=0&zoom_x=0000000&zoom_y=0000000&fog=0"
print(tm_str)
try:
urllib.request.urlretrieve(url, f"img/{tm_str}.png")
except Exception as e:
print("Error: ", e)
time.sleep(5)
continue
time.sleep(1)
tm = tm - timedelta(minutes=5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment