-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,35 @@ | ||
# github-calendar-graph-crawler | ||
Get the contributon calendar graph on GitHub personal page. | ||
# github-calendar-graph | ||
Get the GitHub contributon calendar graph. | ||
|
||
## Demo | ||
GET `/graph/:account` | ||
response `text/html` | ||
![graph](https://i.imgur.com/Czee71O.png) | ||
Append the calendar graph as you see at GitHub to everywhere you want. | ||
![demo](https://i.imgur.com/14y9I9O.png) | ||
|
||
GET `/data/:account` | ||
response `application/json` | ||
![json](https://i.imgur.com/BIihkaC.png) | ||
## Install | ||
``` | ||
$ npm install github-calendar-graph --save | ||
``` | ||
|
||
## Installation | ||
1. `git clone https://github.com/x3388638/github-calendar-graph-crawler.git` | ||
2. `cd github-calendar-graph-crawler` | ||
3. `npm install` | ||
4. `npm start` | ||
5. http://localhost:7774/graph/x3388638 | ||
6. http://localhost:7774/data/x3388638 | ||
## Usage | ||
```javascript | ||
const CalendarGraph = require('github-calendar-graph'); | ||
|
||
// get contribution graph | ||
CalendarGraph.fetch('GITHUB ACCOUNT').then((data) => { | ||
console.log(data); // => string of HTML DOM | ||
}); | ||
|
||
// get contribution count | ||
CalendarGraph.fetch('GITHUB ACCOUNT', true).then((data) => { | ||
console.log(data); // => { 'DATE': 'CONTRIBUTION COUNT' } | ||
/* | ||
{ | ||
'2018-07-01': 3, | ||
'2018-07-02': 1, | ||
'2018-07-03': 9, | ||
... | ||
} | ||
*/ | ||
}); | ||
|
||
``` |