Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
442 views
in Technique[技术] by (71.8m points)

ios - 尝试使用curl从电报bot发送用户视频(Trying to send user video from telegram bot using curl)

using command:

(使用命令:)

curl -s _X POST "https://api.telegram.org/bot<token>/sendVideo -F chat_id=<chatID> -F video="@myvideo.mp4"

sends a video file "myvideo.mp4" ok to the telegram user chatID from my bot with token value "token" .

(从我的机器人向令牌用户chatID发送一个视频文件“ myvideo.mp4”,并带有令牌值“ token”。)

However unlike when sending from the telegram-cli https://github.com/vysheng/tg (I used previous to bots being available) the file appears black when opened on an iPad or iBook telegram client.

(但是,与从电报cli https://github.com/vysheng/tg发送时(我之前曾使用过bot时使用过)发送的文件不同,在iPad或iBook电报客户端上打开时,文件显示为黑色。)

However if I save it from there to the Camera Roll I can open the file and play the video there.

(但是,如果我从那里将其保存到“相机胶卷”中,则可以打开文件并在那里播放视频。)

On an iMac desktop telegram client I can click the file and open it with QuickTime player OK.

(在iMac桌面电报客户端上,我可以单击文件并使用QuickTime Player OK打开它。)

The file is 640x480 and about 3Mb.

(该文件为640x480,约为3Mb。)

Sending messages or photos using a similar technique works fine.

(使用类似的技术发送消息或照片效果很好。)

Any ideas what I need to tweak to get this to work properly?

(有什么需要调整才能正常工作的想法吗?)

I have seen lots of examples for sending messsages or photos, but can find none for sending videos.

(我已经看到了许多发送邮件或照片的示例,但找不到发送视频的示例。)

  ask by rbn translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

尝试这个

curl -F video=@"/path/to/video/file" https://api.telegram.org/bot<token>/sendVideo?chat_id=<chat_id>


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...