Skip to content
/ csn-ng Public

A proper API library and CLI tools for chiasenhac.vn

License

Notifications You must be signed in to change notification settings

l4rzy/csn-ng

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Description

  • A proper API library and CLI tools for chiasenhac.vn
  • Built around chiasenhac.vn JSON API

Get and build

  • As a go library
$ go get -u 'github.com/l4rzy/csn-ng'
  • As a cli application
$ go install 'github.com/l4rzy/csn-ng/csn@latest'

Usage

  • As a library
package main

import (
    "fmt"
    csn "github.com/l4rzy/csn-ng"
    "os"
)

func main() {
    keyword := os.Args[1]
    result, err := csn.SearchNew(csn.KIND_MUSIC, keyword, 10)
    if err != nil {
        fmt.Printf("Could not get data: %v\n", err)
        os.Exit(-1)
    }

    for _, r := range result {
        r.Print()
        info, _ := r.GetInfo()
        info.PrintLinks(true, csn.MUSIC_QUAL_ALL)
    }
}
  • As a commandline tool

Make sure that $GOPATH/bin is in your $PATH

$ csn search -link -limit 3 -music "what I've done"

The result should look like this test

License

MIT

About

A proper API library and CLI tools for chiasenhac.vn

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages