resubir a mano
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
Cat /dev/Nulo 2023-05-09 20:40:54 -03:00
parent 2e61e51be9
commit 2d02edf907
2 changed files with 22 additions and 2 deletions

22
main.go
View file

@ -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)

View file

@ -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