telegram上传大视频
Telegram bot的文件大小限定为50MB。
我需要发送大文件。
有没有措施解决?
我知道这个项目 https://github.com/pwrtelegram/pwrtelegram 但我无法使它工作。
大概有人已经解决了这个问题?
有一个选项可以通过Telegram API实现文件上传,然后通过
file_id
与bot一起发送。
我使用库 https://github.com/rubenlagus/TelegramBots 在Java中编写了一个bot
UPDATE
为理解决这个问题,我使用telegram api,对大文件限定为1.5 GB。
我更嘻歡kotlogram – 完美的lib和精良的文档 https://github.com/badoualy/kotlogram
更新2
我怎样使用这个lib的例子:
private void uploadToServer(TelegramClient telegramClient, TLInputPeerChannel tlInputPeerChannel, Path pathToF!ile, int partSize) { File file = pathToFile.toFile(); long fileId = getRandomId(); int totalParts = Math.toIntExact(file.length() / partSize + 1); int filePart = 0; int offset = filePart * partSize; try (InputStream is = new FileInputStream(file)) { byte[] buffer = new byte[partSize]; int read; while ((read = is.read(buffer, offset, partSize)) != -1) { TLBytes bytes = new TLBytes(buffer, 0, read); TLBool tlBool = telegramClient.uploadSaveBigFilePart(fileId, filePart, totalParts, bytes); telegramClient.clearSentMessageList(); filePart++; } } catch (Exception e) { log.error("Error uploading file to server", e); } finally { telegramClient.close(); } sendToChannel(telegramClient, tlInputPeerChannel, "FILE_NAME.zip", fileId, totalParts) } private void sendToChannel(TelegramClient telegramClient, TLInputPeerChannel tlInputPeerChannel, String name, long f!ileId, int totalParts) { try { String mimeType = name.substring(name.indexOf(".") + 1); TLVector<TLAbsDocumentAttribute> attributes = new TLVector<>(); attributes.add(new TLDocumentAttributeFilename(name)); TLInputFileBig inputFileBig = new TLInputFileBig(fileId, totalParts, name); TLInputMediaUploadedDocument document = new TLInputMediaUploadedDocument(inputFileBig, mimeType, attributes, "", null); TLAbsUpdates tlAbsUpdates = telegramClient.messagesSendMedia(false, false, false, tlInputPeerChannel, null, document, getRandomId(), null); } catch (Exception e) { log.error("Error sending file by id into channel", e); } finally { telegramClient.close(); } }
此中
TelegramClient telegramClient
和
TLInputPeerChannel tlInputPeerChannel
可以在文档中创建。
不要复制 – 粘贴,重写您的需求。
Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign up
Files
Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
You can’t perform that action at this time.
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
我知道有一些特别的网站,好比
Youtube,Vimeo和…
,我可以在此中一个上传我的视频!并将其链接表现在Telegram中,表现其大视频预览下的消息并通过
InApp-Player
播放。
但我想知道是否可以通过
MP4
的链接表现
大型视频预览
(如电话留言下的
Youtube
视频预览)文件或
个人
主机上的
页
?是否可以使用开放图?
本文网址:
http://www.1cm8858.com/d/2020623103234_129_3637570389/home
Ten articles before and after
【女奴】字母圈电报群内部视频付费各种口味应有尽有-电报telegram技巧分享
制作符合vcard标准的二维码qrGet快拍购物-电报telegram技巧分享
国内使用telegram加密通讯工具排名电报群为何是第一?-电报telegram技巧分享
實用app》圖解步驟教你telegram申請帳號、中文化、創頻道跟群組、隱私權設定蹦啾♥謝蘿莉Lavieheureuse-电报telegram技巧分享
电脑对话框太大怎么缩小?中华民国经济部(MinistryofEconomicAffairs-电报telegram技巧分享
香港乱局如何被操控?黑客少年窃取的“数据帝国”-电报telegram技巧分享
黄瓜视频馬來之窗合作之旅丝瓜在线观看訪問團赴西亞考察系列報道之一-电报telegram技巧分享
earthTelegram福利资源群老司机开车群-电报telegram技巧分享
安卓手机收不到消息提醒的解决方法AnswertotheinabilityreceiveaverificationcodeSMS「关于无法接收验证码短信解答」-电报telegram技巧分享