1.1.1 • Published 5 years ago
github_repository_scraper v1.1.1
GithubScraper
Github scraper recursively grabs every file in a Github repository and returns it as a JSON object with sources.
Usage
Run npm i github_repository_scraper to install the package.
let getContents = require(github_repository_scraper);
getContents(sUser, sRepo, sPath, oDump, sAuth) => ArraygetContents is a recursive function, meaning that it will go through every directory and grab the source.
sUser is the owner of the repository e.g. gsckoco
sRepo is the repository name e.g. GithubScraper
sPath is the current path to look though, leave this blank if you want to get the source for every file from root downwards.
sAuth is the authentication header you will send to Github. Without this you will be rate limited see this. It is recommended that you use an OAuth token authentication over basic authentication as Github plan on removing Basic authentication soon.
Example
getContents('gsckoco', 'GithubScraper', '/', [], 'token OAUTH-TOKEN').then(dump => {
console.log(dump);
})