Documentation
¶
Index ¶
- Variables
- func CreateXmlDom(content string) *etree.Document
- func DecryptLyrics(encrypted []byte) (string, error)
- func HexStringToByteArray(hexString string) []byte
- func Post(url_ string, param map[string]string) (string, error)
- func RecursionFindElement(elem *etree.Element, mappingDict map[string]string, ...)
- func RemoveIllegalContent(content string) string
- func ReplaceAmp(content string) string
- func ReplaceQuot(content string) string
- func SharpZipLibDecompress(data []byte) []byte
- type QqLyricsResponse
- type QqSearchResponse
- type Song
- type SongResponse
Constants ¶
This section is empty.
Variables ¶
View Source
var ( UserAgent = "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36" Cookie = "os=pc;osver=Microsoft-Windows-10-Professional-build-16299.125-64bit;appver=2.0.3.131777;channel=netease;__remember_me=true" VerbatimXmlMappingDict = map[string]string{ "content": "orig", "contentts": "ts", "contentroma": "roma", "Lyric_1": "lyric", } )
View Source
var ( // 使用 regexp2 编译支持前瞻断言的正则 AmpRegex = regexp2.MustCompile(`&(?![a-zA-Z]{2,6};|#[0-9]{2,4};)`, regexp2.None) QuotRegex = regexp2.MustCompile( `(\s+[\w:.-]+\s*=\s*")(([^"]*)((")((?![^"]*\s+[\w:.-]+\s*=\s*"|[\s/]*>))[^"]*)*)"`, regexp2.None) )
View Source
var (
QQKey = []byte("!@#)(*$%123ZXC!@!@#)(NHL")
)
Functions ¶
func CreateXmlDom ¶
public static XmlDocument Create(string content)
{
content = RemoveIllegalContent(content);
content = ReplaceAmp(content);
var _content = ReplaceQuot(content);
var doc = new XmlDocument();
try
{
doc.LoadXml(_content);
}
catch
{
doc.LoadXml(content);
}
return doc;
}
func DecryptLyrics ¶
func HexStringToByteArray ¶
func RecursionFindElement ¶
func RemoveIllegalContent ¶
func ReplaceAmp ¶
func ReplaceQuot ¶
func SharpZipLibDecompress ¶
Types ¶
type QqLyricsResponse ¶
type QqLyricsResponse struct {
Lyrics string `json:"lyrics"`
Trans string `json:"trans"`
Roma string `json:"roma"`
}
func GetLyrics ¶
func GetLyrics(id string) (*QqLyricsResponse, error)
func GetLyricsByMid ¶
func GetLyricsByMid(mid string) (*QqLyricsResponse, error)
type QqSearchResponse ¶
type QqSearchResponse struct {
Code int `json:"code"`
Ts int64 `json:"ts"`
StartTs int64 `json:"start_ts"`
Traceid string `json:"traceid"`
Req1 struct {
Code int `json:"code"`
Data struct {
Body struct {
Album struct {
List []any `json:"list"`
} `json:"album"`
Gedantip struct {
Tab int `json:"tab"`
Tip string `json:"tip"`
} `json:"gedantip"`
Mv struct {
List []any `json:"list"`
} `json:"mv"`
Qc []any `json:"qc"`
Singer struct {
List []any `json:"list"`
} `json:"singer"`
Song struct {
List []struct {
Act int `json:"act"`
Action struct {
Alert int `json:"alert"`
Icon2 int64 `json:"icon2"`
Icons int `json:"icons"`
Msgdown int `json:"msgdown"`
Msgfav int `json:"msgfav"`
Msgid int `json:"msgid"`
Msgpay int `json:"msgpay"`
Msgshare int `json:"msgshare"`
Switch int `json:"switch"`
Switch2 int `json:"switch2"`
} `json:"action"`
Album struct {
ID int `json:"id"`
Mid string `json:"mid"`
Name string `json:"name"`
Pmid string `json:"pmid"`
Subtitle string `json:"subtitle"`
TimePublic string `json:"time_public"`
Title string `json:"title"`
} `json:"album"`
Bpm int `json:"bpm"`
Content string `json:"content"`
Desc string `json:"desc"`
DescHilight string `json:"desc_hilight"`
Docid string `json:"docid"`
Eq int `json:"eq"`
Es string `json:"es"`
File struct {
B30S int `json:"b_30s"`
E30S int `json:"e_30s"`
HiresBitdepth int `json:"hires_bitdepth"`
HiresSample int `json:"hires_sample"`
MediaMid string `json:"media_mid"`
Size128Mp3 int `json:"size_128mp3"`
Size192Aac int `json:"size_192aac"`
Size192Ogg int `json:"size_192ogg"`
Size24Aac int `json:"size_24aac"`
Size320Mp3 int `json:"size_320mp3"`
Size360Ra []any `json:"size_360ra"`
Size48Aac int `json:"size_48aac"`
Size96Aac int `json:"size_96aac"`
Size96Ogg int `json:"size_96ogg"`
SizeApe int `json:"size_ape"`
SizeDolby int `json:"size_dolby"`
SizeDts int `json:"size_dts"`
SizeFlac int `json:"size_flac"`
SizeHires int `json:"size_hires"`
SizeNew []int `json:"size_new"`
SizeTry int `json:"size_try"`
TryBegin int `json:"try_begin"`
TryEnd int `json:"try_end"`
URL string `json:"url"`
} `json:"file"`
Fnote int `json:"fnote"`
Genre int `json:"genre"`
Grp []struct {
Act int `json:"act"`
Action struct {
Alert int `json:"alert"`
Icon2 int64 `json:"icon2"`
Icons int `json:"icons"`
Msgdown int `json:"msgdown"`
Msgfav int `json:"msgfav"`
Msgid int `json:"msgid"`
Msgpay int `json:"msgpay"`
Msgshare int `json:"msgshare"`
Switch int `json:"switch"`
Switch2 int `json:"switch2"`
} `json:"action"`
Album struct {
ID int `json:"id"`
Mid string `json:"mid"`
Name string `json:"name"`
Pmid string `json:"pmid"`
Subtitle string `json:"subtitle"`
TimePublic string `json:"time_public"`
Title string `json:"title"`
} `json:"album"`
Bpm int `json:"bpm"`
Content string `json:"content"`
Desc string `json:"desc"`
DescHilight string `json:"desc_hilight"`
Docid string `json:"docid"`
Eq int `json:"eq"`
Es string `json:"es"`
File struct {
B30S int `json:"b_30s"`
E30S int `json:"e_30s"`
HiresBitdepth int `json:"hires_bitdepth"`
HiresSample int `json:"hires_sample"`
MediaMid string `json:"media_mid"`
Size128Mp3 int `json:"size_128mp3"`
Size192Aac int `json:"size_192aac"`
Size192Ogg int `json:"size_192ogg"`
Size24Aac int `json:"size_24aac"`
Size320Mp3 int `json:"size_320mp3"`
Size360Ra []any `json:"size_360ra"`
Size48Aac int `json:"size_48aac"`
Size96Aac int `json:"size_96aac"`
Size96Ogg int `json:"size_96ogg"`
SizeApe int `json:"size_ape"`
SizeDolby int `json:"size_dolby"`
SizeDts int `json:"size_dts"`
SizeFlac int `json:"size_flac"`
SizeHires int `json:"size_hires"`
SizeNew []int `json:"size_new"`
SizeTry int `json:"size_try"`
TryBegin int `json:"try_begin"`
TryEnd int `json:"try_end"`
URL string `json:"url"`
} `json:"file"`
Fnote int `json:"fnote"`
Genre int `json:"genre"`
Grp []any `json:"grp"`
Hotness struct {
Desc string `json:"desc"`
IconURL string `json:"icon_url"`
JumpType int `json:"jump_type"`
JumpURL string `json:"jump_url"`
} `json:"hotness"`
Href3 string `json:"href3"`
ID int `json:"id"`
IndexAlbum int `json:"index_album"`
IndexCd int `json:"index_cd"`
Interval int `json:"interval"`
Isonly int `json:"isonly"`
Ksong struct {
ID int `json:"id"`
Mid string `json:"mid"`
} `json:"ksong"`
Label string `json:"label"`
Language int `json:"language"`
Lyric string `json:"lyric"`
LyricHilight string `json:"lyric_hilight"`
Mid string `json:"mid"`
Mv struct {
ID int `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Vid string `json:"vid"`
Vt int `json:"vt"`
} `json:"mv"`
Name string `json:"name"`
NewStatus int `json:"newStatus"`
Ov int `json:"ov"`
Pay struct {
PayDown int `json:"pay_down"`
PayMonth int `json:"pay_month"`
PayPlay int `json:"pay_play"`
PayStatus int `json:"pay_status"`
PriceAlbum int `json:"price_album"`
PriceTrack int `json:"price_track"`
TimeFree int `json:"time_free"`
} `json:"pay"`
Protect int `json:"protect"`
Sa int `json:"sa"`
Singer []struct {
ID int `json:"id"`
Mid string `json:"mid"`
Name string `json:"name"`
Pmid string `json:"pmid"`
Title string `json:"title"`
Type int `json:"type"`
Uin int `json:"uin"`
} `json:"singer"`
Status int `json:"status"`
Subtitle string `json:"subtitle"`
Tag int `json:"tag"`
Tid int `json:"tid"`
TimePublic string `json:"time_public"`
Title string `json:"title"`
TitleHilight string `json:"title_hilight"`
Type int `json:"type"`
URL string `json:"url"`
Version int `json:"version"`
Vf []float64 `json:"vf"`
Vi []int `json:"vi"`
Volume struct {
Gain float64 `json:"gain"`
Lra float64 `json:"lra"`
Peak float64 `json:"peak"`
} `json:"volume"`
Vs []string `json:"vs"`
} `json:"grp"`
Hotness struct {
Desc string `json:"desc"`
IconURL string `json:"icon_url"`
JumpType int `json:"jump_type"`
JumpURL string `json:"jump_url"`
} `json:"hotness"`
Href3 string `json:"href3"`
ID int `json:"id"`
IndexAlbum int `json:"index_album"`
IndexCd int `json:"index_cd"`
Interval int `json:"interval"`
Isonly int `json:"isonly"`
Ksong struct {
ID int `json:"id"`
Mid string `json:"mid"`
} `json:"ksong"`
Label string `json:"label"`
Language int `json:"language"`
Lyric string `json:"lyric"`
LyricHilight string `json:"lyric_hilight"`
Mid string `json:"mid"`
Mv struct {
ID int `json:"id"`
Name string `json:"name"`
Title string `json:"title"`
Vid string `json:"vid"`
Vt int `json:"vt"`
} `json:"mv"`
Name string `json:"name"`
NewStatus int `json:"newStatus"`
Ov int `json:"ov"`
Pay struct {
PayDown int `json:"pay_down"`
PayMonth int `json:"pay_month"`
PayPlay int `json:"pay_play"`
PayStatus int `json:"pay_status"`
PriceAlbum int `json:"price_album"`
PriceTrack int `json:"price_track"`
TimeFree int `json:"time_free"`
} `json:"pay"`
Protect int `json:"protect"`
Sa int `json:"sa"`
Singer []struct {
ID int `json:"id"`
Mid string `json:"mid"`
Name string `json:"name"`
Pmid string `json:"pmid"`
Title string `json:"title"`
Type int `json:"type"`
Uin int `json:"uin"`
} `json:"singer"`
Status int `json:"status"`
Subtitle string `json:"subtitle"`
Tag int `json:"tag"`
Tid int `json:"tid"`
TimePublic string `json:"time_public"`
Title string `json:"title"`
TitleHilight string `json:"title_hilight"`
Type int `json:"type"`
URL string `json:"url"`
Version int `json:"version"`
Vf []float64 `json:"vf"`
Vi []int `json:"vi"`
Volume struct {
Gain float64 `json:"gain"`
Lra float64 `json:"lra"`
Peak float64 `json:"peak"`
} `json:"volume"`
Vs []string `json:"vs"`
} `json:"list"`
} `json:"song"`
Songlist struct {
List []any `json:"list"`
} `json:"songlist"`
User struct {
List []any `json:"list"`
} `json:"user"`
Zhida struct {
List []struct {
AlbumList struct {
Items []any `json:"items"`
} `json:"album_list"`
CustomInfo struct {
BeginTime string `json:"begin_time"`
EndTime string `json:"end_time"`
ExtraDesc string `json:"extra_desc"`
From string `json:"from"`
Grade string `json:"grade"`
IconType string `json:"icon_type"`
IconType2 string `json:"icon_type2"`
IconType2Schema string `json:"icon_type2_schema"`
Ifpicurl string `json:"ifpicurl"`
IsFollow string `json:"is_follow"`
Mid string `json:"mid"`
OneLineDesc string `json:"one_line_desc"`
ParentIds string `json:"parent_ids"`
PlayList string `json:"play_list"`
Pos string `json:"pos"`
SearchHistory string `json:"search_history"`
SourceD string `json:"source_d"`
TabID string `json:"tab_id"`
Ticket string `json:"ticket"`
Tribe string `json:"tribe"`
} `json:"custom_info"`
Desciption string `json:"desciption"`
Docid string `json:"docid"`
ID string `json:"id"`
Jumpurl string `json:"jumpurl"`
Mid string `json:"mid"`
Pic string `json:"pic"`
PublishDate string `json:"publish_date"`
Title string `json:"title"`
TrackList struct {
Items []any `json:"items"`
} `json:"track_list"`
Type int `json:"type"`
Vid string `json:"vid"`
VideoType int `json:"video_type"`
} `json:"list"`
} `json:"zhida"`
} `json:"body"`
Code int `json:"code"`
FeedbackURL string `json:"feedbackURL"`
Meta struct {
Cid string `json:"cid"`
Curpage int `json:"curpage"`
Dir string `json:"dir"`
DisplayOrder []any `json:"display_order"`
Ein int `json:"ein"`
EstimateSum int `json:"estimate_sum"`
Expid string `json:"expid"`
FeedbackPlaceID string `json:"feedbackPlaceId"`
IsFilter int `json:"is_filter"`
NextPageStart struct {
} `json:"next_page_start"`
Nextpage int `json:"nextpage"`
Perpage int `json:"perpage"`
Query string `json:"query"`
ReportInfo struct {
Items struct {
} `json:"items"`
} `json:"report_info"`
ResultTrustworthy int `json:"result_trustworthy"`
Ret int `json:"ret"`
SafetyType int `json:"safetyType"`
SafetyURL string `json:"safetyUrl"`
Searchid string `json:"searchid"`
Sid string `json:"sid"`
Sin int `json:"sin"`
StepRelaSyntaxTree struct {
} `json:"step_rela_syntax_tree"`
Sum int `json:"sum"`
TabList []int `json:"tab_list"`
UID string `json:"uid"`
V int `json:"v"`
} `json:"meta"`
Ver int `json:"ver"`
} `json:"data"`
} `json:"req_1"`
}
func GetMusicRawData ¶
func GetMusicRawData(q string, limit, page int) (*QqSearchResponse, error)
搜索歌曲返回原始数据
type SongResponse ¶
func GetSong ¶
func GetSong(mid string) *SongResponse
Click to show internal directories.
Click to hide internal directories.