doubanbookapi

command module
v0.0.0-...-ba1ec4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 7, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

README

doubanbookapi

Just as the name, the API implemention for "Douban Book".

You can query book information via api which provided by Douban.com and save it to local MongoDB.

Now a days, we finished the feature search engine supported via ElasticSearch.

Version

  • 0.0.3

Content

  • Requirements
  • Installation
  • Settings

Requirements

  1. Internet connection
  2. MongoDB v4.0.1 (Single-node or Cluster)
  3. [Optional] ElasticSearch v6.4.2 (with IK plugin)

Installation

  1. Make sure you have MongoDB installed and own the administrator role.
  2. Create one database which named by "smartlibrarian".
  3. Restore the Mongo(Structure & Data) by the json format script below.
    $PRJ_ROOT/install/mongodb/smartlibrarian.sl_book_new.json
    
  4. Restore the ElasticSearch Index & Type mapping.
    $PRJ_ROOT/install/elasticsearch/sl_book_new.book.txt
    

Settings

Site Settings

Website listening on:

Addr: 0.0.0.0
Port: 8080

If you want to change, just modify the file below:

<PRJ_ROOT>/configs/AppConfig.go
DB Settings

You can change MongoDB service here:

<PRJ_ROOT>/configs/MongoDBConfig.go
ES Settings

You can change ElasticSearch service here:

<PRJ_ROOT>/configs/EsConfig.go

How to use

Query API

Query Mongo directly and no search engine accelerate.

You can query book by Isbn, Author and even by Douban book Identifier(id).

  • by isbn

    • Method 1:

        curl -XGET http://localhost:8080/v1/book/isbn/{ISBN}
      
    • Or use the alias method, it's pretty shorter.

         curl -XGET http://localhost:8080/v1/book/{ISBN}    
      
  • by author

      curl -XGET http://localhost:8080/v1/book/author/{AUTHOR}
    
  • by douban idntifier

      curl -XGET http://localhost:8080/v1/book/id/{DOUBAN_ID}
    

Examples here:

  • by isbn

      curl -XGET http://localhost:8080/v1/book/9787556820825
    
  • by ahthor

      curl -XGET http://localhost:8080/v1/book/author/斯坦尼斯
    
  • by douban id

      curl -XGET http://localhost:8080/v1/book/id/26952828
    
CIP API

Douban book API could not provide CIP information.

But we can fetch books' CIP information from opac.calis.edu.cn

P.S. Special Thanks to CALIS.

ISBN API
Search API

Data accelerated by ElasticSearch.

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL