Compare commits

..

No commits in common. "2d02edf9079c90006b0f19e76e67d2a9e47758aa" and "e032af23882dd2f6652b59c24982430cc4cbb5bc" have entirely different histories.

2 changed files with 3 additions and 26 deletions

27
main.go
View file

@ -1,9 +1,7 @@
package main package main
import ( import (
"io"
"log" "log"
"net/http"
"net/url" "net/url"
"os" "os"
"strings" "strings"
@ -18,24 +16,6 @@ type Config struct {
Responders []common.Responder 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) { func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update) {
var explicit bool var explicit bool
@ -78,13 +58,10 @@ func (config Config) handleMessage(bot *tgbotapi.BotAPI, update tgbotapi.Update)
} }
if uploadable != nil { if uploadable != nil {
res := tgbotapi.NewVideo(update.Message.Chat.ID, FileURL(uploadable.Url)) res := tgbotapi.NewVideo(update.Message.Chat.ID, tgbotapi.FileURL(uploadable.Url))
res.ReplyToMessageID = update.Message.MessageID res.ReplyToMessageID = update.Message.MessageID
res.Caption = uploadable.Caption res.Caption = uploadable.Caption
_, err := bot.Send(res) bot.Send(res)
if err != nil {
log.Println("Error subiendo", url.String(), err)
}
} }
if explicit && érror == common.NotValid { if explicit && érror == common.NotValid {

View file

@ -2,7 +2,7 @@ Un bot para Telegram que permite descargar videos de distintos lugares.
[@dlthefourthbot](https://t.me/dlthefourthbot) [@dlthefourthbot](https://t.me/dlthefourthbot)
~~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 :( Es rápido ya que ni siquiera descarga el video, solo le pasa a Telegram la URL para descargarlos.
## TikTok ## TikTok