Documentation ¶
Index ¶
- Constants
- Variables
- func DecryptSongFile(key []byte, inputPath, outputPath string) error
- func DumpResponse(resp *http.Response, message string)
- func ECB(key, data []byte) ([]byte, error)
- func MD5Hash(data []byte) string
- func MakeURLPath(track *Track, format Format) (string, error)
- type API
- func (api *API) ApiRequest(method string, body io.Reader) (*http.Response, error)
- func (api *API) CookieLogin(arl string) error
- func (api *API) GetAlbumData(ID int) (*Album, error)
- func (api *API) GetSongData(ID int) (*Track, error)
- func (api *API) MobileApiRequest(method string, body io.Reader) (*http.Response, error)
- type Album
- type AlbumResponse
- type AlbumTrack
- type Covers
- type Format
- type Track
Constants ¶
const ( FLAC Format = 9 MP3_320 = 3 MP3_256 = 5 MP3_128 = 1 )
const AlbumAPIFormat = "https://api.deezer.com/album/%d"
Variables ¶
var NoMD5Error = errors.New("no MD5 hash -- try authenticating")
Functions ¶
func DecryptSongFile ¶
DecryptSongFile decrypts the encrypted chunks of a song downloaded from deezer
func DumpResponse ¶
DumpResponse dumps a response with logrus
func ECB ¶
ECB implementation since golang technically doesn't support it based on https://stackoverflow.com/questions/24072026/golang-aes-ecb-encryption input data is automatically zero-padded
Types ¶
type API ¶
func (*API) ApiRequest ¶
ApiRequest performs an API request
func (*API) CookieLogin ¶
CookieLogin allows the user to log in using their arl cookie taken from a browser
func (*API) GetAlbumData ¶ added in v0.2.0
GetAlbum gets the album based on its ID
func (*API) GetSongData ¶
GetSongData gets a track
type Album ¶ added in v0.2.0
type Album struct { ID int Title string Link string CoverURL string Covers Covers Date time.Time Tracklist []AlbumTrack Tracks []*Track // contains filtered or unexported fields }
Album stores the data for the album of interest
type AlbumResponse ¶ added in v0.2.0
type AlbumResponse struct { ID int `json:"id"` Title string `json:"title"` Link string `json:"link"` CoverURL string `json:"cover"` CoverSmall string `json:"cover_small"` CoverMedium string `json:"cover_medium"` CoverBig string `json:"cover_big"` CoverXL string `json:"cover_xl"` Date string `json:"release_date"` Tracks struct { Data []AlbumTrack `json:"data"` } `json:tracks"` }
AlbumResponse is an intermediate format for getting album data that stores the data before putting it in an Album struct
type AlbumTrack ¶ added in v0.2.0
type Track ¶
type Track struct { ID int `json:"SNG_ID,string"` Title string `json:"SNG_TITLE"` TrackNumber int `json:"TRACK_NUMBER,string"` Gain float32 `json:"GAIN,string"` MD5 string `json:"MD5_ORIGIN"` MediaVersion int `json:"MEDIA_VERSION,string"` // contains filtered or unexported fields }
func (*Track) GetBlowfishKey ¶
getBlowfishKey calculates the key required to decrypt the blowfish-encrypted file
func (*Track) GetDownloadURL ¶
GetDownloadURL gets the download url (as a *url.URL) for a given format