Compare commits
22 Commits
v1.0.2
...
25eafe3959
| Author | SHA1 | Date | |
|---|---|---|---|
| 25eafe3959 | |||
| a250bb7c9b | |||
|
8768ea181c
|
|||
|
7e0fd89e11
|
|||
| 445e10fa16 | |||
|
0b621acdfb
|
|||
| bdfd612fa0 | |||
| de6e50179a | |||
|
38691be66b
|
|||
|
46bbecb280
|
|||
| 772993a596 | |||
|
f809b08c37
|
|||
| 4f3b30885e | |||
| 6c0316ac28 | |||
|
52cc00190b
|
|||
|
a7765f90d9
|
|||
| 7b4d25d484 | |||
|
b392048ca1
|
|||
| b0cb606afe | |||
|
f303eb3eb8
|
|||
| e641e1d2a5 | |||
|
a6dc4e27b9
|
@@ -3,7 +3,7 @@
|
||||
|
||||
########################################
|
||||
# Versions
|
||||
ARG YT_DLP_VERSION="2026.03.03"
|
||||
ARG YT_DLP_VERSION="2026.03.17"
|
||||
|
||||
################################################################################
|
||||
# Deno builder stage
|
||||
@@ -38,7 +38,7 @@ RUN case "$TARGETARCH" in \
|
||||
|
||||
################################################################################
|
||||
# FFmpeg builder stage
|
||||
FROM debian:13-slim@sha256:1d3c811171a08a5adaa4a163fbafd96b61b87aa871bbc7aa15431ac275d3d430 AS ffmpeg-builder
|
||||
FROM debian:13-slim@sha256:4ffb3a1511099754cddc70eb1b12e50ffdb67619aa0ab6c13fcd800a78ef7c7a AS ffmpeg-builder
|
||||
RUN apt-get update && \
|
||||
apt-get install -y --no-install-recommends ffmpeg
|
||||
COPY --from=yt-dlp-builder /rootfs/bin/yt-dlp /yt-dlp
|
||||
@@ -54,7 +54,7 @@ RUN mkdir -p /rootfs/bin && \
|
||||
|
||||
################################################################################
|
||||
# App builder stage
|
||||
FROM golang:1.26.1-trixie@sha256:ab8c4944b04c6f97c2b5bffce471b7f3d55f2228badc55eae6cce87596d5710b AS app-builder
|
||||
FROM golang:1.26.1-trixie@sha256:e3474b933b6d2ba307819482c2d7faef57bbdc3beda1f5caf3e8ed51b3177844 AS app-builder
|
||||
|
||||
COPY app/ /opt/app
|
||||
WORKDIR /opt/app
|
||||
|
||||
@@ -4,7 +4,7 @@ go 1.25.2
|
||||
|
||||
require (
|
||||
github.com/bwmarrin/discordgo v0.29.0
|
||||
github.com/lrstanley/go-ytdlp v1.3.3
|
||||
github.com/lrstanley/go-ytdlp v1.3.5
|
||||
)
|
||||
|
||||
require (
|
||||
|
||||
@@ -16,6 +16,10 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/lrstanley/go-ytdlp v1.3.3 h1:Y9kJcdTwskPWDiwONMIl501Dhi+OrTF7HHY6J6+Lbco=
|
||||
github.com/lrstanley/go-ytdlp v1.3.3/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
|
||||
github.com/lrstanley/go-ytdlp v1.3.4 h1:x3ppgdeN3FbguT5ifc6ISrgjYN10+dVUAbprA7/dYrk=
|
||||
github.com/lrstanley/go-ytdlp v1.3.4/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
|
||||
github.com/lrstanley/go-ytdlp v1.3.5 h1:eT+29mK3Lp+XPMQOH25+jVerrrjifYW1o3IkTYJ9SMs=
|
||||
github.com/lrstanley/go-ytdlp v1.3.5/go.mod h1:VgjnTrvkTf+23JuySjyPq1iQ8ijSovBtTPpXH5XrLtI=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
|
||||
|
||||
25
app/main.go
25
app/main.go
@@ -6,6 +6,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"sort"
|
||||
"strings"
|
||||
"syscall"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
@@ -365,8 +366,20 @@ func main() {
|
||||
h(s, i)
|
||||
}
|
||||
case discordgo.InteractionMessageComponent:
|
||||
if h, ok := componentHandlers[i.MessageComponentData().CustomID]; ok {
|
||||
customID := i.MessageComponentData().CustomID
|
||||
if h, ok := componentHandlers[customID]; ok {
|
||||
h(s, i)
|
||||
} else if strings.HasPrefix(customID, "retry:") {
|
||||
url := strings.TrimPrefix(customID, "retry:")
|
||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseUpdateMessage,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: fmt.Sprintf("%s Fetching available formats...", loading_emoji),
|
||||
Components: []discordgo.MessageComponent{},
|
||||
Flags: discordgo.MessageFlagsEphemeral,
|
||||
},
|
||||
})
|
||||
go fetchAndShowFormats(s, i, url)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -444,6 +457,16 @@ func fetchAndShowFormats(s *discordgo.Session, i *discordgo.InteractionCreate, u
|
||||
if err != nil {
|
||||
_, err = s.InteractionResponseEdit(i.Interaction, &discordgo.WebhookEdit{
|
||||
Content: ptr("❌ Error fetching formats: " + err.Error()),
|
||||
Components: &[]discordgo.MessageComponent{
|
||||
&discordgo.ActionsRow{
|
||||
Components: []discordgo.MessageComponent{
|
||||
discordgo.Button{
|
||||
Label: "Retry",
|
||||
CustomID: fmt.Sprintf("retry:%s", url),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
if err != nil {
|
||||
log.Printf("Error updating interaction: %v", err)
|
||||
|
||||
@@ -19,7 +19,9 @@ func GetFormats(url string) (*FormatOptions, error) {
|
||||
SkipDownload().
|
||||
DumpJSON()
|
||||
|
||||
result, err := dl.Run(context.TODO(), url)
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute)
|
||||
defer cancel()
|
||||
result, err := dl.Run(ctx, url)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user