2.0.1 • Published 7 years ago
lihkg-api-nodejs-client v2.0.1
lihkg-api-nodejs-client
LIHKG API client for node.js
Installation
npm install lihkg-api-nodejs-client --save
TL;DR
const lihkg = require('lihkg-api-nodejs-client');
lihkg.getLatestBlowWater().then(result => {
// threads from 吹水台
}).catch(error => {
// handle error
});
Usage
Thread
- .getLatestBlowWater([page, count]) ⇒
Promise
- .getLatestHot([page, count]) ⇒
Promise
- .getLatestNew([page, count]) ⇒
Promise
- .getChannel(category, [page, count]) ⇒
Promise
- .getThread(threadID, [page, count]) ⇒
Promise
- .search(query, [page, count]) ⇒
Promise
Auth
Thread
.getLatestBlowWater(page, count) ⇒ Promise
Use this method to get the latest threads in 吹水台.
Param | Type | Description |
---|---|---|
page | Number | default: 1 |
count | Number | default: 30 |
.getLatestHot(page, count) ⇒ Promise
Use this method to get the latest hot threads.
Param | Type | Description |
---|---|---|
page | Number | default: 1 |
count | Number | default: 30 |
.getLatestNew(page, count) ⇒ Promise
Use this method to get the latest new threads.
Param | Type | Description |
---|---|---|
page | Number | default: 1 |
count | Number | default: 30 |
.getChannel(category, page, count) ⇒ Promise
Use this method to get the threads in a category(channel).
Param | Type | Description |
---|---|---|
category | Number | Refer to Categories |
page | Number | default: 1 |
count | Number | default: 30 |
.getThread(threadID, page, count) ⇒ Promise
Use this method to get a thread for the unique ID.
Param | Type | Description |
---|---|---|
threadID | Number | Thread id returned from the threads list |
page | Number | default: 1 |
count | Number | default: 30 |
.search(query, page, count) ⇒ Promise
Use this method to search threads contain the query in the title.
Param | Type | Description |
---|---|---|
query | String | query string |
page | Number | default: 1 |
count | Number | default: 30 |
Auth
.login(email, password) ⇒ Promise
Use this method to login. User ID and token is cached for further authentication.
Param | Type | Description |
---|---|---|
String | username | |
password | String | password |
Special Thanks
- 連尼住
- HKG+
- 望遠
- https://na.cx
- colloquet
Author
License
lihkg-api-nodejs-client
is available under the MIT license. See the LICENSE file for more info.