Skip to content

Instantly share code, notes, and snippets.

@ziozzang
Last active July 30, 2021 10:01
Show Gist options
  • Save ziozzang/6cd9a2f3a71896c31137afc7bbfaa944 to your computer and use it in GitHub Desktop.
Save ziozzang/6cd9a2f3a71896c31137afc7bbfaa944 to your computer and use it in GitHub Desktop.
코로나 잔량 백신 검색 스크립트

코로나 백신 잔량 검색 스크립트

  • 네이버 맵 API를 사용 합니다.

  • 언제든지 동작 하지 않을수 있습니다.

  • 그냥 가져가서 쓰세요

  • 지정된 좌표 주변으로 최대 100개의 의료기관을 검색해서 잔량 백신을 검색해서 수량을 알려줍니다.

사용법

  • 파이썬 3 + requests에서 동작 합니다.
./corona_vaccine_check.py x좌표 y좌표

# 예시
./corona_vaccine_check.py 126.4900722 37.4927208
  • 좌표는 네이버 맵이든 어디든 따면 됩니다.
#!/usr/bin/python3
import requests
url = 'https://api.place.naver.com/graphql'
header = {'content-type': 'application/json'}
query = '''[{"operationName":"vaccineList","variables":{"input":{"keyword":"코로나백신위탁의료기관","x":"XPOS","y":"YPOS"},"businessesInput":{"start":0,"display":100,"deviceType":"mobile","x":"XPOS","y":"YPOS","sortingOrder":"distance"},"isNmap":false,"isBounds":false},"query":"query vaccineList($input: RestsInput, $businessesInput: RestsBusinessesInput, $isNmap: Boolean\u0021, $isBounds: Boolean\u0021) {\\n rests(input: $input) {\\n businesses(input: $businessesInput) {\\n total\\n vaccineLastSave\\n isUpdateDelayed\\n items {\\n id\\n name\\n dbType\\n phone\\n virtualPhone\\n hasBooking\\n hasNPay\\n bookingReviewCount\\n description\\n distance\\n commonAddress\\n roadAddress\\n address\\n imageUrl\\n imageCount\\n tags\\n distance\\n promotionTitle\\n category\\n routeUrl\\n businessHours\\n x\\n y\\n imageMarker @include(if: $isNmap) {\\n marker\\n markerSelected\\n __typename\\n }\\n markerLabel @include(if: $isNmap) {\\n text\\n style\\n __typename\\n }\\n isDelivery\\n isTakeOut\\n isPreOrder\\n isTableOrder\\n naverBookingCategory\\n bookingDisplayName\\n bookingBusinessId\\n bookingVisitId\\n bookingPickupId\\n vaccineQuantity {\\n quantity\\n quantityStatus\\n vaccineType\\n vaccineOrganizationCode\\n __typename\\n }\\n __typename\\n }\\n optionsForMap @include(if: $isBounds) {\\n maxZoom\\n minZoom\\n includeMyLocation\\n maxIncludePoiCount\\n center\\n __typename\\n }\\n __typename\\n }\\n queryResult {\\n keyword\\n vaccineFilter\\n categories\\n region\\n isBrandList\\n filterBooking\\n hasNearQuery\\n isPublicMask\\n __typename\\n }\\n __typename\\n }\\n}\\n"}]'''
if __name__ == '__main__':
import sys
if len(sys.argv) <3:
print('> Usage cmd [xpos] [ypox]')
exit(0)
query_xy=query.replace('XPOS', sys.argv[1]).replace('YPOS', sys.argv[2]).encode('UTF-8')
resp = requests.post(url, headers=header,data=query_xy)
r = resp.json()
d = r[0]['data']['rests']['businesses']
for i in d['items']:
if int(i['vaccineQuantity']['quantity']) <1:
continue
print (i['name'],'[',i['commonAddress'], i['address'].split()[0],']', i['vaccineQuantity']['quantity'])
@ArchsouL
Copy link

Goooooooooooood!!

@cwal1220
Copy link

감사합니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment