xmlydownloader

package module
v0.0.0-...-5e0781e Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2020 License: MIT Imports: 13 Imported by: 0

README

xmlydownload

喜马拉雅FM下载相关API, 使用Go语言编写.

本项目仅供学习交流使用,如需进行其他用途,请遵照许可协议Fork,使用本软件所造成的一切后果与本人无关。

GUI版本: https://github.com/jing332/xmly-downloader-qt5

Documentation

Index

Constants

View Source
const (
	UserAgentPC      = "ting_v6.7.3_c5(CFNetwork, iOS 13.7, iPhone12,5)"
	UserAgentAndroid = "ting_6.3.60(sdk,Android16)"
)
View Source
const (
	PC = 1 << iota
	Android
)

Variables

This section is empty.

Functions

func DecryptEp

func DecryptEp(data string) string

DecryptEp 解密Ep(Android API)

func DecryptFileId

func DecryptFileId(data string) string

DecryptFileId 解密FileId(Android API)

func DecryptFileName

func DecryptFileName(send int, s string) string

DecryptFileName 解密文件名

func DecryptUrlParams

func DecryptUrlParams(s string) (sign string, buyKey, token, timestamp int)

DecryptUrlParams 解密URL参数

func DestroyJavaVM

func DestroyJavaVM() error

DestroyJavaVM 销毁JavaVM

func GetAlbumInfo

func GetAlbumInfo(albumID int) (title string, audioCount, pageCount int, err error)

GetAlbumInfo 获取专辑信息

func HttpGet

func HttpGet(url string, userAgent int) (*http.Response, error)

HttpGet 请求GET

userAgent: PC, Android

func HttpGetByCookie

func HttpGetByCookie(url, cookie string, userAgent int) (*http.Response, error)

HttpGetByCookie 使用Cookie请求GET

userAgent: PC, Android

func InitJavaVM

func InitJavaVM(jvmDlPath, jarPath string)

InitJavaVM 初始化JavaVM

Types

type AudioInfo

type AudioInfo struct {
	TrackID         int    `json:"trackId"`
	TrackRecordID   int    `json:"trackRecordId"`
	UID             int    `json:"uid"`
	PlayURL64       string `json:"playUrl64"` //mp3 64kbps
	PlayURL32       string `json:"playUrl32"` //mp3 32kbps
	PlayPathHq      string `json:"playPathHq"`
	PlayPathAacv164 string `json:"playPathAacv164"` //m4a 64kbps
	PlayPathAacv224 string `json:"playPathAacv224"` //m4a 24kbps
	Title           string `json:"title"`
	Duration        int    `json:"duration"`
	AlbumID         int    `json:"albumId"`
	AlbumTitle      string `json:"albumTitle"`
	AlbumImage      string `json:"albumImage"`
	IsPaid          bool   `json:"isPaid"`
	IsFree          bool   `json:"isFree"`
	IsVideo         bool   `json:"isVideo"`
	IsDraft         bool   `json:"isDraft"`
	IsRichAudio     bool   `json:"isRichAudio"`
	IsAuthorized    bool   `json:"isAuthorized"`
	PriceTypeID     int    `json:"priceTypeId"`
	PriceTypeEnum   int    `json:"priceTypeEnum"`
	Type            int    `json:"type"`
	RelatedID       int    `json:"relatedId"`
	OrderNo         int    `json:"orderNo"`
	VipFirstStatus  int    `json:"vipFirstStatus"`
	PaidType        int    `json:"paidType"`
}

AudioInfo Mobile接口的音频信息

func GetAllAudioInfo

func GetAllAudioInfo(albumID int) (list []*AudioInfo, err error)

GetAllAudioInfo 获取所有音频信息

func GetAudioInfo

func GetAudioInfo(albumID, page, pageSize int) (audioList []AudioInfo, err error)

GetAudioInfo 获取音频信息

func GetVipAudioInfo

func GetVipAudioInfo(trackId int, cookie string) (ai *AudioInfo, err error)

GetVipAudioInfo 获取VIP音频信息

type AudioInfoMobile

type AudioInfoMobile struct {
	Msg  string `json:"msg"`
	Ret  int    `json:"ret"`
	Data struct {
		List []struct {
			TrackID                int     `json:"trackId"`
			TrackRecordID          int     `json:"trackRecordId"`
			UID                    int     `json:"uid"`
			PlayURL64              string  `json:"playUrl64"`
			PlayURL32              string  `json:"playUrl32"`
			PlayPathHq             string  `json:"playPathHq"`
			PlayPathAacv164        string  `json:"playPathAacv164"`
			PlayPathAacv224        string  `json:"playPathAacv224"`
			Title                  string  `json:"title"`
			Duration               int     `json:"duration"`
			AlbumID                int     `json:"albumId"`
			IsPaid                 bool    `json:"isPaid"`
			IsFree                 bool    `json:"isFree"`
			IsVideo                bool    `json:"isVideo"`
			IsDraft                bool    `json:"isDraft"`
			IsRichAudio            bool    `json:"isRichAudio"`
			IsAuthorized           bool    `json:"isAuthorized"`
			Price                  float64 `json:"price"`
			DiscountedPrice        float64 `json:"discountedPrice"`
			PriceTypeID            int     `json:"priceTypeId"`
			SampleDuration         int     `json:"sampleDuration"`
			PriceTypeEnum          int     `json:"priceTypeEnum"`
			DisplayPrice           string  `json:"displayPrice"`
			DisplayDiscountedPrice string  `json:"displayDiscountedPrice"`
			VipPrice               float64 `json:"vipPrice"`
			DisplayVipPrice        string  `json:"displayVipPrice"`
			Type                   int     `json:"type"`
			RelatedID              int     `json:"relatedId"`
			OrderNo                int     `json:"orderNo"`
			IsHoldCopyright        bool    `json:"isHoldCopyright"`
			VipFirstStatus         int     `json:"vipFirstStatus"`
			PaidType               int     `json:"paidType"`
			IsSample               bool    `json:"isSample"`
			ProcessState           int     `json:"processState"`
			CreatedAt              int64   `json:"createdAt"`
			CoverSmall             string  `json:"coverSmall"`
			CoverMiddle            string  `json:"coverMiddle"`
			CoverLarge             string  `json:"coverLarge"`
			Nickname               string  `json:"nickname"`
			SmallLogo              string  `json:"smallLogo"`
			UserSource             int     `json:"userSource"`
			OpType                 int     `json:"opType"`
			IsPublic               bool    `json:"isPublic"`
			Likes                  int     `json:"likes"`
			Playtimes              int     `json:"playtimes"`
			Comments               int     `json:"comments"`
			Shares                 int     `json:"shares"`
			Status                 int     `json:"status"`
			ExpireTime             int64   `json:"expireTime"`
			IsTrailer              bool    `json:"isTrailer"`
		} `json:"list"`
		PageID     int `json:"pageId"`
		PageSize   int `json:"pageSize"`
		MaxPageID  int `json:"maxPageId"`
		TotalCount int `json:"totalCount"`
	} `json:"data"`
}

AudioInfoMobile Mobile接口

type ChargeTrackInfo

type ChargeTrackInfo struct {
	Ret                  int    `json:"ret"`
	Msg                  string `json:"msg"`
	TrackID              int    `json:"trackId"`
	UID                  int    `json:"uid"`
	AlbumID              int    `json:"albumId"`
	Title                string `json:"title"`
	Domain               string `json:"domain"`
	TotalLength          int    `json:"totalLength"`
	SampleDuration       int    `json:"sampleDuration"`
	SampleLength         int    `json:"sampleLength"`
	IsAuthorized         bool   `json:"isAuthorized"`
	APIVersion           string `json:"apiVersion"`
	Seed                 int    `json:"seed"`
	FileID               string `json:"fileId"`
	BuyKey               string `json:"buyKey"`
	Duration             int    `json:"duration"`
	Ep                   string `json:"ep"`
	HighestQualityLevel  int    `json:"highestQualityLevel"`
	DownloadQualityLevel int    `json:"downloadQualityLevel"`
}

VipTrackInfo VIP音频信息(MobileAPI)

需使用 Java unidbg库 解密音频URL unidbg: https://github.com/zhkl0228/unidbg

func GetChargeTrackInfo

func GetChargeTrackInfo(trackID int, cookie string) (info *ChargeTrackInfo, err error)

GetChargeTrackInfo 获取付费音频信息(Android API)

func (*ChargeTrackInfo) DecryptAndToURL

func (cti *ChargeTrackInfo) DecryptAndToURL() string

DecryptAndToURL 解密Ep与FileId并返回音频URL

type Playlist

type Playlist struct {
	Msg        string       `json:"msg"`
	Ret        int          `json:"ret"`
	MaxPageID  int          `json:"maxPageId"`
	PageSize   int          `json:"pageSize"`
	List       []*AudioInfo `json:"list"`
	PageID     int          `json:"pageId"`
	TotalCount int          `json:"totalCount"`
}

Playlist 播放列表

https://mobwsa.ximalaya.com/mobile/playlist/album/page?albumId=%d&pageId=%d

func GetAudioInfoListByPageID

func GetAudioInfoListByPageID(albumID, pageID int) (playlist *Playlist, err error)

GetAudioInfoListByPageID 使用PageID获取音频信息列表

type QRCode

type QRCode struct {
	Ret  int    `json:"ret"`
	Msg  string `json:"msg"`
	QrID string `json:"qrId"`
	Img  string `json:"img"`
}

QRCode 二维码

func GetQRCode

func GetQRCode() (qrCode *QRCode, err error)

GetQRCode 获取登录二维码

type QRCodeStatus

type QRCodeStatus struct {
	Ret                int         `json:"ret"`
	Msg                string      `json:"msg"`
	BizKey             interface{} `json:"bizKey"`
	UID                int         `json:"uid"`
	Token              interface{} `json:"token"`
	UserType           interface{} `json:"userType"`
	IsFirst            bool        `json:"isFirst"`
	ToSetPwd           bool        `json:"toSetPwd"`
	LoginType          string      `json:"loginType"`
	MobileMask         string      `json:"mobileMask"`
	MobileCipher       string      `json:"mobileCipher"`
	CaptchaInfo        interface{} `json:"captchaInfo"`
	Avatar             interface{} `json:"avatar"`
	ThirdpartyAvatar   interface{} `json:"thirdpartyAvatar"`
	ThirdpartyNickname interface{} `json:"thirdpartyNickname"`
	SmsKey             interface{} `json:"smsKey"`
	ThirdpartyID       interface{} `json:"thirdpartyId"`
}

QRCodeStatus 二维码状态

func CheckQRCodeStatus

func CheckQRCodeStatus(qrID string) (status *QRCodeStatus, cookie string, err error)

CheckQRCodeStatus 检查二维码的状态

type TrackInfo

type TrackInfo struct {
	TrackID                int     `json:"trackId"`
	TrackRecordID          int     `json:"trackRecordId"`
	UID                    int     `json:"uid"`
	PlayURL64              string  `json:"playUrl64"`
	PlayURL32              string  `json:"playUrl32"`
	PlayPathAacv164        string  `json:"playPathAacv164"`
	PlayPathAacv224        string  `json:"playPathAacv224"`
	Title                  string  `json:"title"`
	Duration               int     `json:"duration"`
	AlbumID                int     `json:"albumId"`
	IsPaid                 bool    `json:"isPaid"`
	IsFree                 bool    `json:"isFree"`
	IsVideo                bool    `json:"isVideo"`
	IsDraft                bool    `json:"isDraft"`
	IsRichAudio            bool    `json:"isRichAudio"`
	IsAuthorized           bool    `json:"isAuthorized"`
	Price                  float64 `json:"price"`
	DiscountedPrice        float64 `json:"discountedPrice"`
	PriceTypeID            int     `json:"priceTypeId"`
	SampleDuration         int     `json:"sampleDuration"`
	PriceTypeEnum          int     `json:"priceTypeEnum"`
	DisplayPrice           string  `json:"displayPrice"`
	DisplayDiscountedPrice string  `json:"displayDiscountedPrice"`
	Type                   int     `json:"type"`
	RelatedID              int     `json:"relatedId"`
	OrderNo                int     `json:"orderNo"`
	IsHoldCopyright        bool    `json:"isHoldCopyright"`
	VipFirstStatus         int     `json:"vipFirstStatus"`
	PaidType               int     `json:"paidType"`
	IsSample               bool    `json:"isSample"`
	ProcessState           int     `json:"processState"`
	CreatedAt              int64   `json:"createdAt"`
	CoverSmall             string  `json:"coverSmall"`
	CoverMiddle            string  `json:"coverMiddle"`
	CoverLarge             string  `json:"coverLarge"`
	Nickname               string  `json:"nickname"`
	UserSource             int     `json:"userSource"`
	OpType                 int     `json:"opType"`
	IsPublic               bool    `json:"isPublic"`
	Likes                  int     `json:"likes"`
	Playtimes              int     `json:"playtimes"`
	Comments               int     `json:"comments"`
	Shares                 int     `json:"shares"`
	Status                 int     `json:"status"`
	IsTrailer              bool    `json:"isTrailer"`
}

TrackInfo 音频信息(MobileV1API)

TrackList

type TrackList

type TrackList struct {
	Msg  string `json:"msg"`
	Ret  int    `json:"ret"`
	Data struct {
		List       []*TrackInfo `json:"list"`
		PageID     int          `json:"pageId"`
		PageSize   int          `json:"pageSize"`
		MaxPageID  int          `json:"maxPageId"`
		TotalCount int          `json:"totalCount"`
	} `json:"data"`
}

TrackList 音频列表(MobileV1API)

https://mobile.ximalaya.com/mobile/v1/album/track/ts-%d?ac=WIFI&albumId=%d&device=android&isAsc=%t&pageId=%d&pageSize=200

func GetTrackListByMobile

func GetTrackListByMobile(albumID, pageID int, isAsc bool) (tracks *TrackList, err error)

GetAlbumInfoByMobileAPI 使用MobileV1API获取音频列表

isAsc: true为升序(默认), false为降序

type UserInfo

type UserInfo struct {
	Ret  int    `json:"ret"`
	Msg  string `json:"msg"`
	Data struct {
		UID           int         `json:"uid"`
		RealUID       int         `json:"realUid"`
		Nickname      string      `json:"nickname"`
		LogoPic       string      `json:"logoPic"`
		IsLoginBan    bool        `json:"isLoginBan"`
		IsVerified    bool        `json:"isVerified"`
		Ptitle        interface{} `json:"ptitle"`
		Mobile        string      `json:"mobile"`
		IsRobot       bool        `json:"isRobot"`
		VerifyType    int         `json:"verifyType"`
		IsVip         bool        `json:"isVip"`
		VipExpireTime int         `json:"vipExpireTime"`
		AnchorGrade   int         `json:"anchorGrade"`
		UserGrade     int         `json:"userGrade"`
		UserTitle     interface{} `json:"userTitle"`
		LogoType      int         `json:"logoType"`
	} `json:"data"`
}

UserInfo 用户信息

func GetUserInfo

func GetUserInfo(cookie string) (*UserInfo, error)

GetUserInfo 使用Cookie获取用户信息

type VipAudioInfo

type VipAudioInfo struct {
	Ret                  int    `json:"ret"`
	Msg                  string `json:"msg"`
	TrackID              int    `json:"trackId"`
	UID                  int    `json:"uid"`
	AlbumID              int    `json:"albumId"`
	Title                string `json:"title"`
	Domain               string `json:"domain"`
	TotalLength          int    `json:"totalLength"`
	SampleDuration       int    `json:"sampleDuration"`
	SampleLength         int    `json:"sampleLength"`
	IsAuthorized         bool   `json:"isAuthorized"`
	APIVersion           string `json:"apiVersion"`
	Seed                 int    `json:"seed"`
	FileID               string `json:"fileId"`
	BuyKey               string `json:"buyKey"`
	Duration             int    `json:"duration"`
	Ep                   string `json:"ep"`
	HighestQualityLevel  int    `json:"highestQualityLevel"`
	DownloadQualityLevel int    `json:"downloadQualityLevel"`
	AuthorizedType       int    `json:"authorizedType"`
}

VipAudioInfo VIP音频信息(WebAPI)

需使用 DecryptFileName(send, fileId) 与 DecryptUrlParams(ep) 解密音频URL

type Xmly

type Xmly struct {
	CgStr      string
	RandomSeed float64
}

func New

func New(send float64) *Xmly

func (*Xmly) CgFun

func (x *Xmly) CgFun(t string) string

func (*Xmly) CgHun

func (x *Xmly) CgHun()

func (*Xmly) Ran

func (x *Xmly) Ran() float64

Jump to

Keyboard shortcuts

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