requests

package
v0.0.0-...-5ad9136 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Url  string
	Host string
	Key  string
}

func NewClient

func NewClient(url, host, key string) *Client

func (*Client) MultiSearch

func (c *Client) MultiSearch(artist string) (string, error)

MultiSearch partially implements Shazam Core API GET MultiSearch this function only queries for SONGS_ARTISTS and can not do SONGS and ARTISTS independently

type ShazamResponse

type ShazamResponse struct {
	Tracks struct {
		Hits []struct {
			Track struct {
				Layout   string `json:"layout"`
				Type     string `json:"type"`
				Key      string `json:"key"`
				Title    string `json:"title"`
				Subtitle string `json:"subtitle"`
				Share    struct {
					Subject  string `json:"subject"`
					Text     string `json:"text"`
					Href     string `json:"href"`
					Image    string `json:"image"`
					Twitter  string `json:"twitter"`
					HTML     string `json:"html"`
					Avatar   string `json:"avatar"`
					Snapchat string `json:"snapchat"`
				} `json:"share"`
				Images struct {
					Background string `json:"background"`
					Coverart   string `json:"coverart"`
					Coverarthq string `json:"coverarthq"`
					Joecolor   string `json:"joecolor"`
				} `json:"images"`
				Hub struct {
					Type    string `json:"type"`
					Image   string `json:"image"`
					Actions []struct {
						Name string `json:"name"`
						Type string `json:"type"`
						ID   string `json:"id,omitempty"`
						URI  string `json:"uri,omitempty"`
					} `json:"actions"`
					Options []struct {
						Caption string `json:"caption"`
						Actions []struct {
							Name string `json:"name"`
							Type string `json:"type"`
							URI  string `json:"uri"`
							ID   string `json:"id,omitempty"`
						} `json:"actions"`
						Beacondata struct {
							Type         string `json:"type"`
							Providername string `json:"providername"`
						} `json:"beacondata"`
						Image               string `json:"image"`
						Type                string `json:"type"`
						Listcaption         string `json:"listcaption"`
						Overflowimage       string `json:"overflowimage"`
						Colouroverflowimage bool   `json:"colouroverflowimage"`
						Providername        string `json:"providername"`
					} `json:"options"`
					Providers []struct {
						Caption string `json:"caption"`
						Images  struct {
							Overflow string `json:"overflow"`
							Default  string `json:"default"`
						} `json:"images"`
						Actions []struct {
							Name string `json:"name"`
							Type string `json:"type"`
							URI  string `json:"uri"`
						} `json:"actions"`
						Type string `json:"type"`
					} `json:"providers"`
					Explicit    bool   `json:"explicit"`
					Displayname string `json:"displayname"`
				} `json:"hub"`
				Artists []struct {
					ID     string `json:"id"`
					Adamid string `json:"adamid"`
				} `json:"artists"`
				URL string `json:"url"`
			} `json:"track"`
		} `json:"hits"`
	} `json:"tracks"`
	Artists struct {
		Hits []struct {
			Artist struct {
				Avatar   string `json:"avatar"`
				Name     string `json:"name"`
				Verified bool   `json:"verified"`
				Weburl   string `json:"weburl"`
				Adamid   string `json:"adamid"`
			} `json:"artist"`
		} `json:"hits"`
	} `json:"artists"`
}

ShazamResponse is a Json struct of the data returned from the MultiSearch SONGS_ARTIST search type

func (*ShazamResponse) GetRandomTrackUrl

func (s *ShazamResponse) GetRandomTrackUrl() string

GetRandomTrackUrl selects one of the tracks from the response and returns its url

Jump to

Keyboard shortcuts

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