Skip to content

Commit

Permalink
Upgrade deps
Browse files Browse the repository at this point in the history
  • Loading branch information
rroller committed Dec 15, 2024
1 parent 64c5f20 commit 3101d19
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.23.3-alpine3.20 AS builder
FROM golang:1.23.4-alpine3.21 AS builder

RUN apk add --no-cache curl

Expand All @@ -13,7 +13,7 @@ RUN go mod download
RUN go build -x -o media-roller ./src

# yt-dlp needs python
FROM python:3.13.0-alpine3.20
FROM python:3.13.1-alpine3.21

# This is where the downloaded files will be saved in the container.
ENV MR_DOWNLOAD_DIR="/download"
Expand All @@ -31,8 +31,8 @@ COPY static /app/static
WORKDIR /app

# Get new releases here https://github.com/yt-dlp/yt-dlp/releases
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/download/2024.11.04/yt-dlp -o /usr/local/bin/yt-dlp && \
echo "dad4a9ce9db902cf1e69ca71c0ca778917fa5a804a2ab43bac612b0abef76314 /usr/local/bin/yt-dlp" | sha256sum -c - && \
RUN curl -L https://github.com/yt-dlp/yt-dlp/releases/download/2024.12.13/yt-dlp -o /usr/local/bin/yt-dlp && \
echo "ec5f59f8b8908d93b2bdf6663c3ecba70781f39de21255d183220f250ebccc94 /usr/local/bin/yt-dlp" | sha256sum -c - && \
chmod a+rx /usr/local/bin/yt-dlp

RUN yt-dlp --update --update-to nightly
Expand Down
15 changes: 15 additions & 0 deletions src/extractors/streamff.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package extractors

import (
"regexp"
)

// https://streamff.com/v/e70b90d8
var streamffRe = regexp.MustCompile(`^(?:https?://)?(?:www)?\.?streamff\.com/v/([A-Za-z0-9]+)/?`)

func GetUrl(url string) string {
if matches := streamffRe.FindStringSubmatch(url); len(matches) == 2 {
return "https://ffedge.streamff.com/uploads/" + matches[1] + ".mp4"
}
return ""
}
26 changes: 26 additions & 0 deletions src/extractors/streamff_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package extractors

import "testing"

func TestGetUrl(t *testing.T) {
tests := []struct {
name string
url string
want string
}{
{name: "t1", url: "https://streamff.com/v/e70b90d8", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t2", url: "https://streamff.com/v/e70b90d8/", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t3", url: "https://streamff.com/v/e70b90d8/test", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t4", url: "https://streamff.com/v/e70b90d8?test", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t5", url: "https://www.streamff.com/v/e70b90d8", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t6", url: "streamff.com/v/e70b90d8?test", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
{name: "t7", url: "www.streamff.com/v/e70b90d8?test", want: "https://ffedge.streamff.com/uploads/e70b90d8.mp4"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := GetUrl(tt.url); got != tt.want {
t.Errorf("GetUrl() = %v, want %v", got, tt.want)
}
})
}
}

0 comments on commit 3101d19

Please sign in to comment.