feat: add DRM search-by-name fallback for individual Spotify tracks
When SearchYoutube with the Spotify URL fails for individual tracks, offer a 'Search on YouTube' button that lets the user enter a search query (artist/song name) to find the content on YouTube.
This commit is contained in:
@@ -70,7 +70,15 @@ func (h *Handler) handleURLInput(ctx context.Context, chatID int64, text string,
|
||||
if strings.Contains(errMsg, "DRM") {
|
||||
youtubeURL, ytTitle, searchErr := h.YtDlp.SearchYoutube(text)
|
||||
if searchErr != nil {
|
||||
h.sendText(ctx, chatID, fmt.Sprintf("This content is DRM protected and no YouTube alternative was found: %s", errMsg))
|
||||
kb := models.InlineKeyboardMarkup{
|
||||
InlineKeyboard: [][]models.InlineKeyboardButton{
|
||||
{{Text: "Search on YouTube", CallbackData: "drm_search"}},
|
||||
{{Text: "Cancel", CallbackData: "pending_cancel"}},
|
||||
},
|
||||
}
|
||||
h.Bot.SendMessage(ctx, &tgbot.SendMessageParams{
|
||||
ChatID: chatID, Text: "This content is DRM protected and no YouTube alternative was found automatically. Try searching by name:", ReplyMarkup: kb,
|
||||
})
|
||||
return
|
||||
}
|
||||
h.sendText(ctx, chatID, fmt.Sprintf("This content is DRM protected. Found on YouTube: %s", ytTitle))
|
||||
|
||||
Reference in New Issue
Block a user