Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 17 additions & 0 deletions Daegu-bus-API/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
47 changes: 47 additions & 0 deletions Daegu-bus-API/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
200 changes: 200 additions & 0 deletions Daegu-bus-API/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
# 대구버스 API

대구버스 비공식 REST API

## 개요

대구버스는 공개 API를 제공하지 않습니다.

EUC-KR 인코딩과 정리도 되어 있지 않은 DOM을 스크래핑해야 할 개발자분들을 위해, 비공식 API를 만들게 되었습니다!

[대구 버스정보서비스](http://businfo.daegu.go.kr)를 스크래핑+파싱 후 다듬고 json형태로 반환하는 서비스입니다.

## 명세

##### 전체 구조 :

<pre>
/
└ route/
└ / : [노선 조회]
└ search/ : [노선 검색]
└ station/
└ / : [정류장 정보 조회]
└ search/ : [정류장 검색]
</pre>

- 노선 검색

`/route/search/:text`

텍스트를 통해 노선 ID를 검색합니다.

#####응답 예시 :

<pre>
// /route/search/52

[
{"name": "523", sub: "원대오거리방면", "id": "3000523000"},
{"name": "523", sub: "동산네거리방면", "id":"3000523001"},
{"name": "524", sub: "default", "id":"3000524000"},
{"name": "527", sub: "default", "id":"3000527000"}
]
</pre>
523은 방면에 따라 여러 종류의 버스가 있는 경우의 예시입니다.

- 노선 조회

`/route/:id`

노선 고유 ID를 통해 노선을 조회합니다. 버스의 위치를 포함합니다.

##### 응답 예시 :

<pre>
{
"forward":{
route : ["정류소 1", "정류소 2", ... ],
bus : ["정류소 1"]
},
"backward":{
route: ["정류소 1", "정류소 2", ... ],
bus: ["정류소 1", "정류소 2"]
}
}
</pre>

버스는 해당 버스 앞 정거장의 이름 문자열으로 나타납니다. 버스가 가장 앞일 경우 'start' 문자열이 담깁니다.

- 정류장 검색

`/station/search/:text`

텍스트를 통해 정류장 ID를 검색합니다.

#####응답 예시 :

<pre>
// /station/search/서구청

[
{"name":"달서구청건너","id":"7041014900"},
{"name":"달서구청앞","id":"7041014800"},
{"name":"서구청건너","id":"7031008000"},
{"name":"서구청앞","id":"7031007900"}
]
</pre>

- 정류장 정보 조회

`/station/:id`

정류장 ID를 통해 정류장의 정보를 조회합니다.

#####응답 예시 :

<pre>
// /station/7041014900

[{
"name": "달서4",
"sub": "default",
"id": "4030004000",
"forward": "1",
"bus": [{
"버스번호": "3636(저상)",
"현재정류소": "삼성래미안1차건너",
"남은정류소": "13 개소",
"도착예정소요시간": "15 분"
}]
}, {
"name": "급행6",
"sub": "default",
"id": "1000006000",
"forward": "1",
"bus": [{
"버스번호": "1045",
"현재정류소": "진천역AK그랑폴리스아파트앞",
"남은정류소": "4 개소",
"도착예정소요시간": "7 분"
}]
}, {
"name": "706",
"sub": "default",
"id": "3000706000",
"forward": "0",
"bus": [{
"버스번호": "3176",
"현재정류소": "월성e-편한세상건너",
"남은정류소": "2 개소",
"도착예정소요시간": "2 분"
}, {
"버스번호": "3184",
"현재정류소": "토지주택공사앞",
"남은정류소": "12 개소",
"도착예정소요시간": "13 분"
}]
}, {
"name": "623",
"sub": "default",
"id": "3000623001",
"forward": "1",
"bus": [{
"버스번호": "1307",
"현재정류소": "이마트월배점앞",
"남은정류소": "6 개소",
"도착예정소요시간": "11 분"
}, {
"버스번호": "1309(저상)",
"현재정류소": "명곡미래빌5단지앞",
"남은정류소": "15 개소",
"도착예정소요시간": "23 분"
}]
}, {
"name": "달서3",
"sub": "default",
"id": "4030003001",
"forward": "0",
"bus": [{
"버스번호": "2742",
"현재정류소": "상인우방아파트",
"남은정류소": "5 개소",
"도착예정소요시간": "5 분"
}, {
"버스번호": "2720(저상)",
"현재정류소": "삼성래미안2차앞",
"남은정류소": "20 개소",
"도착예정소요시간": "26 분"
}]
}]
</pre>
해당 정거장을 지나는 노선들의 정보와 방면, 정방향 여부, ID, 도착할 버스의 목록으로 이루어집니다.

버스는 객체로 구성됩니다.
<pre>
{
"버스번호": "2839",
"현재정류소": "칠성시장앞1",
"남은정류소": "6 개소",
"도착예정소요시간": "10 분"
},
{
"버스번호": "2818",
"현재정류소": "아양교역(1번출구)",
"종료정류소": "신당동주민센터건너",
"남은정류소": "11 개소",
"도착예정소요시간": "17 분"
}
</pre>
버스가 끊길 무렵에는 배열에 1개의 객체만이 들어가거나 비어있을 수도 있습니다.

여러 방면을 가진 버스는
<pre>
"방면": "동산네거리방면"
</pre>
막차 버스는
<pre>
"종료정류소": "신당동주민센터건너"
</pre>
과 같은 속성이 추가됩니다.
Loading