Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var search_keyword = "cafe+seoul";
- const api_key = "";
- var url = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=" + search_keyword + "&key=" + api_key;
- https.get(url, function (res) {
- var body = '';
- res.on('data', function (chunk) {
- body += chunk;
- });
- res.on('end', function () {
- var response = JSON.parse(body);
- pool.getConnection(function (err, conn) {
- if (err) {
- if (conn) {
- conn.release;
- }
- }
- //INSIDE DB
- // for (var i = 0; i < 20; i++) {
- // var place_id = response.results[i].id;
- // var data = {
- // place_id: place_id
- // };
- // conn.query('INSERT INTO place_id SET ?', data);
- // }
- var next_page_token = response.next_page_token;
- console.log(next_page_token);
- var next_page_url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json?pagetoken=" + next_page_token + "&key=" + api_key;
- console.log(next_page_url);
- // if (response.next_page_token == null) {
- // break;
- // }
- })
- });
- });
- {
- "html_attributions" : [],
- "results" : [],
- "status" : "INVALID_REQUEST"
- }
Add Comment
Please, Sign In to add comment