Showing
4 changed files
with
14 additions
and
7 deletions
... | @@ -2,11 +2,12 @@ let request = require('request'); | ... | @@ -2,11 +2,12 @@ let request = require('request'); |
2 | let cheerio = require('cheerio'); | 2 | let cheerio = require('cheerio'); |
3 | 3 | ||
4 | const bus_url = 'http://apis.data.go.kr/6410000/busarrivalservice/getBusArrivalList'; | 4 | const bus_url = 'http://apis.data.go.kr/6410000/busarrivalservice/getBusArrivalList'; |
5 | -const bus_key = 'RwxSWXH88b2bKOAT6Ot3FHorPZQW9omma0xYIjtJe0JIKe4DC7TjX7Uj6E1ArzYi2AvVETmPrAIYyY8FlL%2BfAA%3D%3D'; | ||
6 | const stationID = '228000708'; // 사색의광장 들어오는 방향 | 5 | const stationID = '228000708'; // 사색의광장 들어오는 방향 |
7 | -const gateStationID = '203000125' | 6 | +const gateStationID = '203000125' |
8 | 7 | ||
9 | -const BusArrivalUrl = bus_url + '?servicekey=' + bus_key + '&stationId=' + stationID;// 사색의광장 정류장 버스 도착 정보 조회용 | 8 | +require('dotenv').config(); |
9 | + | ||
10 | +const BusArrivalUrl = bus_url + '?servicekey=' + process.env.key + '&stationId=' + stationID;// 사색의광장 정류장 버스 도착 정보 조회용 | ||
10 | //console.log(BusArrivalUrl); | 11 | //console.log(BusArrivalUrl); |
11 | 12 | ||
12 | var routeID = []; | 13 | var routeID = []; |
... | @@ -22,10 +23,9 @@ request(BusArrivalUrl, (err, res, body) => { | ... | @@ -22,10 +23,9 @@ request(BusArrivalUrl, (err, res, body) => { |
22 | }) | 23 | }) |
23 | 24 | ||
24 | const route_url = 'http://apis.data.go.kr/6410000/busrouteservice/getBusRouteInfoItem'; | 25 | const route_url = 'http://apis.data.go.kr/6410000/busrouteservice/getBusRouteInfoItem'; |
25 | -const route_key = 'RwxSWXH88b2bKOAT6Ot3FHorPZQW9omma0xYIjtJe0JIKe4DC7TjX7Uj6E1ArzYi2AvVETmPrAIYyY8FlL%2BfAA%3D%3D'; | ||
26 | var index = 0; | 26 | var index = 0; |
27 | function getBusNum(){ | 27 | function getBusNum(){ |
28 | - var BusRouteUrl = route_url + '?servicekey=' + route_key + '&routeId='; // 각 버스 정보 조회용 | 28 | + var BusRouteUrl = route_url + '?servicekey=' + process.env.key + '&routeId='; // 각 버스 정보 조회용 |
29 | BusRouteUrl += routeID[index++]; | 29 | BusRouteUrl += routeID[index++]; |
30 | //console.log(BusRouteUrl); | 30 | //console.log(BusRouteUrl); |
31 | 31 | ||
... | @@ -64,7 +64,7 @@ function useFor(){ | ... | @@ -64,7 +64,7 @@ function useFor(){ |
64 | } | 64 | } |
65 | setTimeout(useFor, 500); | 65 | setTimeout(useFor, 500); |
66 | 66 | ||
67 | -const GateBusUrl = bus_url + '?servicekey=' + bus_key + '&stationId=' + gateStationID; //국제캠 정문 정류장 | 67 | +const GateBusUrl = bus_url + '?servicekey=' + process.env.key + '&stationId=' + gateStationID; //국제캠 정문 정류장 |
68 | let date = new Date(); | 68 | let date = new Date(); |
69 | let curHour = date.getHours(); // 현재 시간 | 69 | let curHour = date.getHours(); // 현재 시간 |
70 | let curMinute = date.getMinutes(); //현재 분 | 70 | let curMinute = date.getMinutes(); //현재 분 | ... | ... |
... | @@ -95,6 +95,11 @@ | ... | @@ -95,6 +95,11 @@ |
95 | "domhandler": "^4.2.0" | 95 | "domhandler": "^4.2.0" |
96 | } | 96 | } |
97 | }, | 97 | }, |
98 | + "dotenv": { | ||
99 | + "version": "10.0.0", | ||
100 | + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz", | ||
101 | + "integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q==" | ||
102 | + }, | ||
98 | "entities": { | 103 | "entities": { |
99 | "version": "2.2.0", | 104 | "version": "2.2.0", |
100 | "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", | 105 | "resolved": "https://registry.npmjs.org/entities/-/entities-2.2.0.tgz", | ... | ... |
-
Please register or login to post a comment