diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..260d911 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,5 @@ +.git +.gitignore +.dockerignore +*.md +*.txt \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..db9fe76 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,18 @@ +FROM golang:alpine AS build + +ARG proxy + +WORKDIR /app/ + +RUN apk --no-cache add ca-certificates + +COPY . . + +RUN sed -i "s/hyperpipe-proxy.onrender.com/$proxy/g" utils.go + +RUN go mod download && \ + go build -ldflags "-s -w" + +EXPOSE 3000 + +CMD ./hyperpipe-backend \ No newline at end of file diff --git a/README.md b/README.md index 3f43de1..93d06bf 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,17 @@ Until NewPipeExtractor Supports Youtube Music Browse endpoints. +## Self-Hosting + +### Docker + +Configure using `docker-compose.yml` ( Set the Proxy URL ) + +Then run + +`# docker-compose up -d` + ## Official Frontend -codeberg.org/Hyperpipe/hyperpipe \ No newline at end of file +https://codeberg.org/Hyperpipe/hyperpipe \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..bc1215e --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,13 @@ +version: '3' + +services: + hyperpipe-backend: + image: hyperpipe-backend + build: + context: . + args: + proxy: "pipopiped.tokhmi.xyz" + container_name: hyperpipe-backend + restart: unless-stopped + ports: + - 3000:3000 \ No newline at end of file diff --git a/main.go b/main.go index 675b9cb..16d28da 100644 --- a/main.go +++ b/main.go @@ -11,7 +11,7 @@ func SetHeaders(c *fiber.Ctx) error { c.Type("json", "utf-8") c.Set("Access-Control-Allow-Origin", "*") c.Set("Access-Control-Allow-Headers", "*") - c.Set("Access-Control-Max-Age", "1728000") + c.Set("Access-Control-Max-Age", "300") return c.Next() } diff --git a/parser.go b/parser.go index a7ac537..cc504ac 100644 --- a/parser.go +++ b/parser.go @@ -43,7 +43,7 @@ func ParseExplore(raw string) (string, error) { j := gjson.Parse(raw) c := j.Get("contents.singleColumnBrowseResultsRenderer.tabs.0.tabRenderer.content" + - ".tabRenderer.content.sectionListRenderer.contents.#.musicCarouselShelfRenderer") + ".sectionListRenderer.contents.#.musicCarouselShelfRenderer") a := c.Get("#(header.musicCarouselShelfBasicHeaderRenderer" + ".title.runs.0.text == New albums & singles)") @@ -51,6 +51,8 @@ func ParseExplore(raw string) (string, error) { ".title.runs.0.text == Trending)") val := Explore{ + TrendingId: t.Get("header.musicCarouselShelfBasicHeaderRenderer" + + ".title.runs.0.navigationEndpoint.browseEndpoint.browseId").String(), Albums: TwoRowItemRenderer("album", a.Get("contents")), Trending: ResponsiveListItemRenderer(t.Get("contents")), } diff --git a/structs.go b/structs.go index 6482409..81c14b6 100644 --- a/structs.go +++ b/structs.go @@ -23,8 +23,9 @@ type Items struct { } type Explore struct { - Albums []Item `json:"albums_and_singles"` - Trending []Item `json:"trending"` + TrendingId string `json:"trendingId"` + Albums []Item `json:"albums_and_singles"` + Trending []Item `json:"trending"` } type Genres struct {