List the URL addresses to download the documentation in epub, pdf or mobi format of book projects hosted by GitBooks.com, using the GitBooks API's client-library in Go.
This client is somehow similar to the API_ReadTheDocs project which lists (and downloads) books hosted by ReadTheDocs.org, but in this case, for GitBook.com.
This is the very first draft, which is a work in progress. The implementation is incomplete and subject to change. The documentation can be inaccurate.
After you have compiled the source code, you may need to setup your GitBook account to authenticate (some books require this). (Note: the GitBook account is not the same as the GitHub account, so far, and you may need to create your free GitBook account.)
# some books require this
export GITBOOK_USER=<your-gitbook-username>
export GITBOOK_PASSWD=<your-gitbook-password>
Call the client program:
./api_client_gitbook -author "<put-author-here>" [-book "<put-optional-book-entry-here>"] [-dump]
The -book "<put-optional-book-entry-here>"
is optional: if omitted, this client will report all books written in GitBook by the given author. The -dump
option means to dump all the metadata about the book that GitBook has, including the date and time of its latest update (or build), etc.
For example:
./api_client_gitbook -author 0xax -book linux-insides
Looking up for book "linux-insides" written by author "0xax"...
EPUB=https://www.gitbook.com/download/epub/book/0xax/linux-insides
PDF=https://www.gitbook.com/download/pdf/book/0xax/linux-insides
Mobi=https://www.gitbook.com/download/mobi/book/0xax/linux-insides
./api_client_gitbook -author unbug -book react-native-training
Looking up for book "react-native-training" written by author "unbug"...
EPUB=https://www.gitbook.com/download/epub/book/unbug/react-native-training
PDF=https://www.gitbook.com/download/pdf/book/unbug/react-native-training
Mobi=https://www.gitbook.com/download/mobi/book/unbug/react-native-training
# to report all books written by a given author, for example:
./api_client_gitbook -author wxdublin
This project is in GoLang and requires the GitBook API Go client library.
-
Set the
GOPATH
environment variable to the base directory where you downloaded this project (or another subdirectory):GOPATH=<put/here/base/directory/of/git/clone/of/this/project> export GOPATH
-
Install the GitBook API Go client library:
go get github.com/GitbookIO/go-gitbook-api
-
For further installing the compiled executable, set the
GOBIN
to the proper directory where to write the executable. As a very simple example:GOBIN="$GOPATH/bin" export GOBIN
-
Compile the source code:
go build src/api_client_gitbook.go go install src/api_client_gitbook.go
This GitBook command-line client is inspired from the GitBook command-line example at https://github.com/GitbookIO/go-gitbook-api.