Hi, metulburr.
Now I learned how to write my scraped-result in Excel, but still can't figure out how to collect only desired information of vr arcades under 'vr' keyword.
I'd like to collect 'title', 'category', 'telephone', 'address' for each item in list or dictionary and print out each set in excel. Please give me any advice.
Now I learned how to write my scraped-result in Excel, but still can't figure out how to collect only desired information of vr arcades under 'vr' keyword.
I'd like to collect 'title', 'category', 'telephone', 'address' for each item in list or dictionary and print out each set in excel. Please give me any advice.
import os import sys import urllib.request client_id = "confidential" client_secret = "confidential" url = "https://openapi.naver.com/v1/search/local.json?query=vr&display=3&start=1" request = urllib.request.Request(url) request.add_header("X-Naver-Client-Id",client_id) request.add_header("X-Naver-Client-Secret",client_secret) response = urllib.request.urlopen(request) rescode = response.getcode() if(rescode==200): responseBody = response.read().decode('utf-8') print(responseBody) file = open("./vr_arcade.csv", "w+") file.write(responseBody) else: print("Error Code:" + rescode)
Output:{
lastBuildDate: "Fri
total: 874
start: 1
display: 3
items: [
{
title: "arcade1"
link: ""
category: "category1"
description: ""
telephone: "telephone"
address: "address"
roadAddress: "roadAddress"
mapx: "310767"
mapy: "550356"
}
{
title: "arcade2"
link: "https://link2"
category: "category2"
description: ""
telephone: "telephone"
address: "address"
roadAddress: "roadAddress"
mapx: "312508"
mapy: "552087"
}
{
title: "arcade3"
link: "arcade3.com"
category: "arcade"
description: ""
telephone: "telephone"
address: "address"
roadAddress: "roadAddress"
mapx: "x"
mapy: "y"
}
]
}
Thanks