From 2d02edf9079c90006b0f19e76e67d2a9e47758aa Mon Sep 17 00:00:00 2001 From: Nulo Date: Tue, 9 May 2023 20:40:54 -0300 Subject: [PATCH] resubir a mano --- main.go | 22 +++++++++++++++++++++- readme.md | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index ec5cc2d..df31692 100644 --- a/main.go +++ b/main.go @@ -1,7 +1,9 @@ package main import ( + "io" "log" + "net/http" "net/url" "os" "strings" @@ -16,6 +18,24 @@ type Config struct { Responders []common.Responder } +type FileURL string + +func (fu FileURL) NeedsUpload() bool { + return true +} + +func (fu FileURL) UploadData() (string, io.Reader, error) { + res, err := http.Get(string(fu)) + if err != nil { + return "", nil, err + } + return "url.mp4", res.Body, nil +} + +func (fu FileURL) SendData() string { + panic("we") +} + func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update) { var explicit bool @@ -58,7 +78,7 @@ func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update) } if uploadable != nil { - res := tgbotapi.NewVideo(update.Message.Chat.ID, tgbotapi.FileURL(uploadable.Url)) + res := tgbotapi.NewVideo(update.Message.Chat.ID, FileURL(uploadable.Url)) res.ReplyToMessageID = update.Message.MessageID res.Caption = uploadable.Caption _, err := bot.Send(res) diff --git a/readme.md b/readme.md index ce7a62e..012d770 100644 --- a/readme.md +++ b/readme.md @@ -2,7 +2,7 @@ Un bot para Telegram que permite descargar videos de distintos lugares. [@dlthefourthbot](https://t.me/dlthefourthbot) -Es rápido ya que ni siquiera descarga el video, solo le pasa a Telegram la URL para descargarlos. +~~Es rápido ya que ni siquiera descarga el video, solo le pasa a Telegram la URL para descargarlos.~~ 2023-05-09: parece que Telegram bloquea urls de Instagram y TikMate con el error `Bad Request: wrong file identifier/HTTP URL specified`, tenemos que resubir manualmente :( ## TikTok