mirror of
https://codeberg.org/Hyperpipe/hyperpipe-backend
synced 2024-12-06 19:26:30 +01:00
Simplified Code
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"io"
|
||||
"log"
|
||||
"bytes"
|
||||
"net/http"
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
func Fetch(path string, data []byte) (string, int, error) {
|
||||
@@ -88,4 +88,4 @@ func FetchNext(id string) (string, int) {
|
||||
|
||||
log.Println(status)
|
||||
log.Println(res)
|
||||
}*/
|
||||
}*/
|
||||
|
||||
@@ -150,9 +150,9 @@ func GetNextSongs(n gjson.Result) []Item {
|
||||
j := v.Get("playlistPanelVideoRenderer")
|
||||
|
||||
r = append(r, Item{
|
||||
Id: j.Get("navigationEndpoint.watchEndpoint.videoId").String(),
|
||||
Title: RunsText(j.Get("title")),
|
||||
Sub: j.Get("longBylineText.runs.2.text").String(),
|
||||
Id: j.Get("navigationEndpoint.watchEndpoint.videoId").String(),
|
||||
Title: RunsText(j.Get("title")),
|
||||
Sub: j.Get("longBylineText.runs.2.text").String(),
|
||||
Thumbnails: GetThumbnails(j.Get("thumbnail.thumbnails")),
|
||||
})
|
||||
}()
|
||||
@@ -210,7 +210,7 @@ func ParseNext(raw string) (string, error) {
|
||||
|
||||
val := Next{
|
||||
MediaSession: MediaSession{
|
||||
Album: RunsText(m.Get("album")),
|
||||
Album: RunsText(m.Get("album")),
|
||||
Thumbnails: GetThumbnails(m.Get("thumbnailDetails.thumbnails")),
|
||||
},
|
||||
Songs: GetNextSongs(n.Get("contents")),
|
||||
@@ -222,4 +222,4 @@ func ParseNext(raw string) (string, error) {
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
}
|
||||
|
||||
+2
-4
@@ -1,6 +1,5 @@
|
||||
package main
|
||||
|
||||
|
||||
/* Parsers */
|
||||
type Thumbnail struct {
|
||||
Height int64 `json:"height"`
|
||||
@@ -34,15 +33,14 @@ type Artist struct {
|
||||
|
||||
type MediaSession struct {
|
||||
Thumbnails []Thumbnail `json:"thumbnails"`
|
||||
Album string `json:"album"`
|
||||
Album string `json:"album"`
|
||||
}
|
||||
|
||||
type Next struct {
|
||||
Songs []Item `json:"songs"`
|
||||
Songs []Item `json:"songs"`
|
||||
MediaSession MediaSession `json:"mediaSession"`
|
||||
}
|
||||
|
||||
|
||||
/* Structs and Types */
|
||||
type Client struct {
|
||||
Name string `json:"clientName"`
|
||||
|
||||
Reference in New Issue
Block a user