mirror of
https://codeberg.org/Hyperpipe/hyperpipe-backend
synced 2024-12-06 19:26:30 +01:00
Support for moreButton in artist page (Hyperpipe/Hyperpipe#34)
This commit is contained in:
+56
-33
@@ -6,10 +6,17 @@ type Client struct {
|
||||
Name string `json:"clientName,omitempty"`
|
||||
Version string `json:"clientVersion,omitempty"`
|
||||
Hl string `json:"hl",omitempty`
|
||||
Url string `json:"originalUrl",omitempty`
|
||||
Visit string `json:"visitorData",omitempty`
|
||||
}
|
||||
|
||||
type Click struct {
|
||||
Param string `json:"clickTrackingParams",omitempty`
|
||||
}
|
||||
|
||||
type Context struct {
|
||||
Client Client `json:"client",omitempty`
|
||||
Click Click `json:"clickTracking",omitempty`
|
||||
}
|
||||
|
||||
type PageType struct {
|
||||
@@ -21,7 +28,7 @@ type BrowseMusicConfig struct {
|
||||
}
|
||||
|
||||
type Form struct {
|
||||
Values []string `json:"selectedValues"`
|
||||
Values []string `json:"selectedValues",omitempty`
|
||||
}
|
||||
|
||||
type WatchMusicConfig struct {
|
||||
@@ -30,11 +37,11 @@ type WatchMusicConfig struct {
|
||||
}
|
||||
|
||||
type BrowseData struct {
|
||||
Context Context `json:"context,omitempty"`
|
||||
MusicConfig BrowseMusicConfig `json:"browseEndpointContextMusicConfig,omitempty"`
|
||||
BrowseId string `json:"browseId,omitempty"`
|
||||
Params string `json:"params,omitempty"`
|
||||
Form Form `json:"formData,omitempty"`
|
||||
Context *Context `json:"context,omitempty"`
|
||||
MusicConfig *BrowseMusicConfig `json:"browseEndpointContextMusicConfig,omitempty"`
|
||||
BrowseId string `json:"browseId,omitempty"`
|
||||
Params *string `json:"params,omitempty"`
|
||||
Form *Form `json:"formData,omitempty"`
|
||||
}
|
||||
|
||||
type NextData struct {
|
||||
@@ -50,38 +57,54 @@ type NextData struct {
|
||||
var BaseContext Context = Context{
|
||||
Client: Client{
|
||||
Name: "WEB_REMIX",
|
||||
Version: "1.20220926.01.00",
|
||||
Hl: "en-US",
|
||||
Version: "1.20230320.01.00",
|
||||
Hl: "en",
|
||||
},
|
||||
}
|
||||
|
||||
func TypeBrowse(t, id, params, form string) BrowseData {
|
||||
if t != "" {
|
||||
return BrowseData{
|
||||
Context: BaseContext,
|
||||
MusicConfig: BrowseMusicConfig{
|
||||
MusicConfig: PageType{
|
||||
PageType: "MUSIC_PAGE_TYPE_" + strings.ToUpper(t),
|
||||
},
|
||||
},
|
||||
BrowseId: id,
|
||||
}
|
||||
} else if form != "" {
|
||||
return BrowseData{
|
||||
Context: BaseContext,
|
||||
BrowseId: id,
|
||||
Params: params,
|
||||
Form: Form{
|
||||
Values: []string{form},
|
||||
},
|
||||
}
|
||||
} else {
|
||||
return BrowseData{
|
||||
Context: BaseContext,
|
||||
BrowseId: id,
|
||||
Params: params,
|
||||
func TypeBrowsePage(id, t string) BrowseData {
|
||||
config := BrowseMusicConfig{
|
||||
MusicConfig: PageType{
|
||||
PageType: "MUSIC_PAGE_TYPE_" + strings.ToUpper(t),
|
||||
},
|
||||
}
|
||||
|
||||
return BrowseData{
|
||||
Context: &BaseContext,
|
||||
MusicConfig: &config,
|
||||
BrowseId: id,
|
||||
}
|
||||
}
|
||||
|
||||
func TypeBrowseForm(id, params, form string) BrowseData {
|
||||
forms := Form{
|
||||
Values: []string{form},
|
||||
}
|
||||
|
||||
return BrowseData{
|
||||
Context: &BaseContext,
|
||||
BrowseId: id,
|
||||
Params: ¶ms,
|
||||
Form: &forms,
|
||||
}
|
||||
}
|
||||
|
||||
func TypeBrowse(id, params string, ct []string) BrowseData {
|
||||
data := BrowseData{
|
||||
Context: &BaseContext,
|
||||
BrowseId: id,
|
||||
Params: ¶ms,
|
||||
}
|
||||
|
||||
if len(ct) > 0 {
|
||||
data.Context.Client.Url = "https://music.youtube.com/channel/" + id
|
||||
data.Context.Client.Visit = ct[1]
|
||||
data.Context.Click = Click{
|
||||
Param: ct[0],
|
||||
}
|
||||
}
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
func TypeNext(id, pid string) NextData {
|
||||
|
||||
Reference in New Issue
Block a user