doubanfm

package module
v0.0.0-...-e808291 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2015 License: MIT Imports: 15 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

doubanfm

douban.fm go library

Documentation

Index

Constants

View Source
const (
	AppName    = "radio_desktop_win"
	AppVersion = "100"
)
View Source
const (
	LoginUrl         = "http://www.douban.com/j/app/login"
	PeopleUrl        = "http://www.douban.com/j/app/radio/people"
	ChannelsUrl      = "http://www.douban.com/j/app/radio/channels"
	LoginChannelsUrl = "http://douban.fm/j/explore/get_login_chls"
)
View Source
const (
	Bypass = "b" // bypass current song (no longer play), refresh playlist
	End    = "e" // end of current song
	New    = "n" // new channel, refresh playlist
	Last   = "p" // last song, refresh playlist
	Skip   = "s" // skip current song, refresh playlist
	Unlike = "u" // unlike current song, refresh playlist
	Like   = "r" // like current song, refresh playlist
)

Variables

This section is empty.

Functions

func LoginChannels

func LoginChannels(id string) (favs []LoginChannel, recs []LoginChannel, err error)

GET http://douban.fm/j/explore/get_login_chls

{
  "status":true,
  "data":{
    "res":{
	  "fav_chls":[
	    {
		  "related_artists":[
			{
			  "cover":"http://img3.douban.com/img/fmadmin/large/31550.jpg",
			  "id":"18250",
			  "name":"李健"
		    },
		    ...
	      ],
	      "creator":{
		    "url":"http://site.douban.com/douban.fm/",
		    "name":"豆瓣FM",
		    "id":1
	      },
	      "intro":"为你推荐 李健 以及相似的艺术家",
	      "banner":"http://img3.douban.com/img/fmadmin/chlBanner/31550.jpg",
	      "id":28250,
	      "name":"李健 系",
	      "cover":"http://img3.douban.com/img/fmadmin/small/31550.jpg",
	      "song_to_start":"",
	      "song_num":0,
	      "collected":"false",
	      "hot_songs":["往日时光","花房姑娘","如果有来生"]
	    }
      ],
      "rec_chls":[]
    }
  }
}

Types

type Artist

type Artist struct {
	Id    json.Number `json:",Number"`
	Name  string
	Cover string
}

type Channel

type Channel struct {
	Id     json.Number `json:"channel_id,Number"`
	Name   string
	Intro  string
	NameEn string `json:"name_en"`
	AbbrEn string `json:"abbr_en"`
	Seq    int    `json:"seq_id"`
}

func Channels

func Channels() (chls []Channel, err error)

GET http://www.douban.com/j/app/radio/channels

{
  "channels":[
    {
      "name_en": "Personal Radio",
      "seq_id": 0,
      "abbr_en": "",
      "name": "私人兆赫",
      "channel_id": "1"
    }
  ]
}

type Creator

type Creator struct {
	Id   json.Number `json:",Number"`
	Name string
	Url  string
}

type LoginChannel

type LoginChannel struct {
	Artists   []Artist `json:"related_artists"`
	Creator   Creator
	Intro     string
	Banner    string
	Id        json.Number `json:",Number"`
	Name      string
	Cover     string
	Start     string      `json:"song_to_start"`
	Num       json.Number `json:"song_num,Number"`
	Collected string
	HotSongs  []string `json:"hot_songs"`
}

type Singer

type Singer struct {
	RelatedSite int  `json:"related_site_id"`
	SiteArtist  bool `json:"is_site_artist"`
	Id          string
	Name        string
}

type Song

type Song struct {
	Sid        string
	Title      string
	Artist     string
	AlbumTitle string
	Album      string
	Ext        string `json:"file_ext"`
	Ssid       string
	Sha256     string
	Status     int
	Picture    string
	Alert      string `json:"alert_msg"`
	Company    string
	RatingAvg  float64 `json:"rating_avg"`
	PubTime    string  `json:"public_time"`
	Singers    []Singer
	Like       int
	ListCount  int `json:"songlists_count"`
	Url        string
	SubType    string
	Length     int
	Aid        string
	Kbps       string
}

func Songs

func Songs(types, cid, sid string, user *User) (songs []Song, err error)

GET http://www.douban.com/j/app/radio/people?app_name=radio_desktop_win&version=100&type=n&channel=1

{
  "logout":1,
  "r":0,
  "version_max":100,
  "is_show_quick_start":0,
  "song":[
    {
      "albumtitle":"Album Title",
      "file_ext":"mp3",
      "album":"\/subject\/1407573\/",
      "ssid":"b037",
      "title":"Title",
      "sid":"630223",
      "sha256":"53b19c0854e9016b39c6144ee6c0da08d5b01393b5899544080cc3d368939245",
      "status":0,
      "picture":"http:\/\/img4.douban.com\/lpic\/s1734968.jpg",
      "alert_msg":"",
      "company":"New World Music",
      "rating_avg":4.30244,
      "public_time":"1992",
      "singers":[
        {
          "related_site_id":0,
          "is_site_artist":false,
          "id":"4204",
          "name":"Kitaro"
        }
      ],
      "like":0,
      "songlists_count":11,
      "artist":"Kitaro",
      "url":"http:\/\/mr3.douban.com\/201508251840\/fd0ebea86b6626f0caa00faff3d28eb2\/view\/song\/small\/p630223_128k.mp3",
      "subtype":"",
      "length":382,
      "aid":"1407573",
      "kbps":"128"
    },
  ]
}

type User

type User struct {
	Id     string `json:"user_id"`
	Name   string `json:"user_name"`
	Email  string
	Token  string
	Expire string
}

func Login

func Login(id, password string) (*User, error)

POST http://www.douban.com/j/app/login

{
  "user_id":"35586494",
  "err":"ok",
  "token":"8e81d12345",
  "expire":"1456109051",
  "r":0,
  "user_name":"Gerry",
  "email":"ginuerzh@gmail.com"
}

Jump to

Keyboard shortcuts

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