Toggle navigation
Toggle navigation
This project
Loading...
Sign in
홍용민
/
BusTime
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Snippets
Network
Create a new issue
Builds
Commits
Issue Boards
Authored by
홍용민
2021-06-06 00:57:01 +0900
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
cd01f210acad0a9d7f0402d6f8d87fe5fe21cecf
cd01f210
1 parent
e473526b
API 키 env파일로 옮김
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
5 deletions
.gitignore
BusInfo.js
package-lock.json
package.json
.gitignore
View file @
cd01f21
test.js
BusInfo.txt
.env
\ No newline at end of file
...
...
BusInfo.js
View file @
cd01f21
...
...
@@ -2,11 +2,12 @@ let request = require('request');
let
cheerio
=
require
(
'cheerio'
);
const
bus_url
=
'http://apis.data.go.kr/6410000/busarrivalservice/getBusArrivalList'
;
const
bus_key
=
'RwxSWXH88b2bKOAT6Ot3FHorPZQW9omma0xYIjtJe0JIKe4DC7TjX7Uj6E1ArzYi2AvVETmPrAIYyY8FlL%2BfAA%3D%3D'
;
const
stationID
=
'228000708'
;
// 사색의광장 들어오는 방향
const
gateStationID
=
'203000125'
const
BusArrivalUrl
=
bus_url
+
'?servicekey='
+
bus_key
+
'&stationId='
+
stationID
;
// 사색의광장 정류장 버스 도착 정보 조회용
require
(
'dotenv'
).
config
();
const
BusArrivalUrl
=
bus_url
+
'?servicekey='
+
process
.
env
.
key
+
'&stationId='
+
stationID
;
// 사색의광장 정류장 버스 도착 정보 조회용
//console.log(BusArrivalUrl);
var
routeID
=
[];
...
...
@@ -22,10 +23,9 @@ request(BusArrivalUrl, (err, res, body) => {
})
const
route_url
=
'http://apis.data.go.kr/6410000/busrouteservice/getBusRouteInfoItem'
;
const
route_key
=
'RwxSWXH88b2bKOAT6Ot3FHorPZQW9omma0xYIjtJe0JIKe4DC7TjX7Uj6E1ArzYi2AvVETmPrAIYyY8FlL%2BfAA%3D%3D'
;
var
index
=
0
;
function
getBusNum
(){
var
BusRouteUrl
=
route_url
+
'?servicekey='
+
route_
key
+
'&routeId='
;
// 각 버스 정보 조회용
var
BusRouteUrl
=
route_url
+
'?servicekey='
+
process
.
env
.
key
+
'&routeId='
;
// 각 버스 정보 조회용
BusRouteUrl
+=
routeID
[
index
++
];
//console.log(BusRouteUrl);
...
...
@@ -64,7 +64,7 @@ function useFor(){
}
setTimeout
(
useFor
,
500
);
const
GateBusUrl
=
bus_url
+
'?servicekey='
+
bus_
key
+
'&stationId='
+
gateStationID
;
//국제캠 정문 정류장
const
GateBusUrl
=
bus_url
+
'?servicekey='
+
process
.
env
.
key
+
'&stationId='
+
gateStationID
;
//국제캠 정문 정류장
let
date
=
new
Date
();
let
curHour
=
date
.
getHours
();
// 현재 시간
let
curMinute
=
date
.
getMinutes
();
//현재 분
...
...
package-lock.json
View file @
cd01f21
...
...
@@ -95,6 +95,11 @@
"domhandler"
:
"^4.2.0"
}
},
"dotenv"
:
{
"version"
:
"10.0.0"
,
"resolved"
:
"https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz"
,
"integrity"
:
"sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
},
"entities"
:
{
"version"
:
"2.2.0"
,
"resolved"
:
"https://registry.npmjs.org/entities/-/entities-2.2.0.tgz"
,
...
...
package.json
View file @
cd01f21
...
...
@@ -14,6 +14,7 @@
"license"
:
"ISC"
,
"dependencies"
:
{
"cheerio"
:
"^1.0.0-rc.9"
,
"dotenv"
:
"^10.0.0"
,
"require"
:
"^2.4.20"
}
}
...
...
Please
register
or
login
to post a comment