Open blue-bird1 opened 5 years ago
这个的话 这些功能其实应该交由酷Q API HTTP接口也就是 coolq-http-plugin这边来实现 不知道cqhttp开发者有没有什么想法 @richardchien
这个下载群文件的接口我目前没有尝试过,酷Q 也没有直接提供,但 酷Q 提供了 cookie,不过暂时 CQHTTP 没有计划加这个功能
酷q没有直接提供的话.我尝试了一下群空间的下载 demo 直接用应该是可以直接作为extra
命令提供.作者在这个项目有没有办法优雅实现提供文件id和群号. @milkice233
@blue-bird1 目测可行 如果上游目前没有实现计划的话那就先EQS这边实现吧 等最近闲下来我再琢磨
稍微看了下 102代表永久存储的文件 104代表临时存储的文件 应该可以实现(自言自语
应该不用作为 extra
命令提供 可以直接下载到 Telegram 服务器上
酷q没有直接提供的话.我尝试了一下群空间的下载 demo 直接用应该是可以直接作为
extra
命令提供.作者在这个项目有没有办法优雅实现提供文件id和群号. @milkice233
@blue-bird1 我试了下...根据酷Q返回的skey算出来的bkn似乎是错的...我这边一直过不了bkn验证,不知道你那边是否可行
我这边能获取到url . 奇怪的是url打开不是下载了.. 是一堆乱码 自己写的代码自己都忘了,要在后面加«Í˜vÿÿŽöëÛ����
/下载文件名
酷q没有直接提供的话.我尝试了一下群空间的下载 demo 直接用应该是可以直接作为
extra
命令提供.作者在这个项目有没有办法优雅实现提供文件id和群号. @milkice233@blue-bird1 我试了下...根据酷Q返回的skey算出来的bkn似乎是错的...我这边一直过不了bkn验证,不知道你那边是否可行
现在是bkn错误么 我这边得到的sky算出来的是正确的
@blue-bird1 没有问题了,解决了,不久就能推更新
不用手算bkn 酷Q会返回csrf_token
@blue-bird1 https://github.com/milkice233/efb-qq-slave/commit/2e9c3a1242b3109c1ab8635e4b9a38365e6d21e6 因为 ETM 的关系,文件名包含中文的还是不能下载
尝试了一下 好像还是和以前一样
uploaded a file to group(地球online)
File ID: /beb1964e-0dcb-11e9-bb26-5452007b592a Filename: Cache_6e82c45b29240add411.bmp.jpg.png.tiff.gif.pcx.tga.exif.fpx.svg.psd.cdr.pcd.dxf.ufo.eps.ai.raw.WMF.webp.efc File size: 3416
uploaded a file to group(地球online)
File ID: /f24a962e-0dc9-11e9-966e-5452007b8f7d Filename: .c4ca4238a0b923820dcc509a6f75849b.acid File size: 34
正确效果应该是怎么样的?
@blue-bird1 有没有进行过
pip3 install git+https://github.com/milkice233/efb-qq-slave --upgrade
这步操作呢
忘了更新了.. 群友上传了一个中文文件
Group File Upload Event:[Download] Error occurs when downloading files: HTTP Error 407: Proxy Authentication Required
是中文导致这个问题么
@blue-bird1 ???按理说不应该这样啊… 你再在pip上更新一次 然后上传中文/英文文件看看 我第二次commit对于中文文件名做了点小小处理 应该也能上传 407的话…其实是有点问题的 和我的预期不符
407没复现成功. 没搞懂什么原因,英文的应该是可以下载的了
407没复现成功. 没搞懂什么原因,英文的应该是可以下载的了
中文现在理应也能下载
文件过大会导致错误 21m的pdf 原子核物理 (修订版)_卢希庭.pdf
2019-01-03 17:32:12,583 [DEBUG]: efb_telegram_master.slave_message (slave_message.slave_message_file; slave_message.py:370)
[2767835603_b4217002-fc88-4173-b364-95f9224e8cc0_1] Uploading file /tmp/tmpe3ufbe_t (application/pdf) as %E3%80%90%E5%AE%8C%E6%95%B4%E7%89%88%E3%80%91%E8%87%AA%E5%8A%A8%E6%8E%A7%E5%88%B6%E5%8E%9F%E7%90%86%EF%BC%88%E7%AC%AC%E4%BA%94%E7%89%88%EF%BC%89%E5%8F%8A%E7%AD%94%E6%A1%88%20%E8%83%A1%E5%AF%BF%E6%9D%BE%E4%B8%BB%E7%BC%96.pdf
2019-01-03 17:32:27,650 [ERROR]: efb_telegram_master.slave_message (slave_message.send_message; slave_message.py:177)
[2767835603_b4217002-fc88-4173-b364-95f9224e8cc0_1] Error occurred while processing message from slave channel.
Message: <EFBMsg, <EFBChat: 咸鱼青鸟 (private_2767835603) @ QQ Slave>@<EFBChat: 地球online (group_618659873) @ QQ Slave> [File]: Sent a file; Attributes: None; Delivering to: <efb_telegram_master.TelegramChannel object at 0x7fabf672bfd0>; Edited: False; System message: False; Substitutions: None; Target messages: None; UID: 2767835603_b4217002-fc88-4173-b364-95f9224e8cc0_1;File: <tempfile._TemporaryFileWrapper object at 0x7fabc53a8c50> (%E3%80%90%E5%AE%8C%E6%95%B4%E7%89%88%E3%80%91%E8%87%AA%E5%8A%A8%E6%8E%A7%E5%88%B6%E5%8E%9F%E7%90%86%EF%BC%88%E7%AC%AC%E4%BA%94%E7%89%88%EF%BC%89%E5%8F%8A%E7%AD%94%E6%A1%88%20%E8%83%A1%E5%AF%BF%E6%9D%BE%E4%B8%BB%E7%BC%96.pdf @ /tmp/tmpe3ufbe_t), application/pdf; Vendor: {}>
NetworkError()
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1055, in _send_output
self.send(chunk)
File "/usr/local/lib/python3.7/http/client.py", line 977, in send
self.sock.sendall(data)
File "/usr/local/lib/python3.7/ssl.py", line 1012, in sendall
v = self.send(byte_view[count:])
File "/usr/local/lib/python3.7/ssl.py", line 981, in send
return self._sslobj.write(data)
socket.timeout: The write operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/telegram/utils/request.py", line 203, in _request_wrapper
resp = self._con_pool.request(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 70, in request
**urlopen_kw)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/request.py", line 148, in request_encode_body
return self.urlopen(method, url, **extra_kw)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/poolmanager.py", line 244, in urlopen
response = conn.urlopen(method, u.request_uri, **kw)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 666, in urlopen
_stacktrace=sys.exc_info()[2])
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/util/retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/packages/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 617, in urlopen
chunked=chunked)
File "/usr/local/lib/python3.7/site-packages/telegram/vendor/ptb_urllib3/urllib3/connectionpool.py", line 390, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/usr/local/lib/python3.7/http/client.py", line 1229, in request
self._send_request(method, url, body, headers, encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1275, in _send_request
self.endheaders(body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1224, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "/usr/local/lib/python3.7/http/client.py", line 1055, in _send_output
self.send(chunk)
File "/usr/local/lib/python3.7/http/client.py", line 977, in send
self.sock.sendall(data)
File "/usr/local/lib/python3.7/ssl.py", line 1012, in sendall
v = self.send(byte_view[count:])
File "/usr/local/lib/python3.7/ssl.py", line 981, in send
return self._sslobj.write(data)
telegram.vendor.ptb_urllib3.urllib3.exceptions.ProtocolError: ('Connection aborted.', timeout('The write operation timed out'))
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/efb_telegram_master/slave_message.py", line 138, in send_message
tg_msg = self.slave_message_file(msg, tg_dest, msg_template, old_msg_id, target_msg_id, reply_markup)
File "/usr/local/lib/python3.7/site-packages/efb_telegram_master/slave_message.py", line 375, in slave_message_file
reply_markup=reply_markup)
File "/usr/local/lib/python3.7/site-packages/efb_telegram_master/bot_manager.py", line 201, in caption_affix
return fn(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/efb_telegram_master/bot_manager.py", line 312, in send_document
return self.updater.bot.send_document(*args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/telegram/bot.py", line 65, in decorator
result = func(self, *args, **kwargs)
File "/usr/local/lib/python3.7/site-packages/telegram/bot.py", line 90, in decorator
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
File "/usr/local/lib/python3.7/site-packages/telegram/utils/request.py", line 305, in post
result = self._request_wrapper('POST', url, fields=data, **urlopen_kwargs)
File "/usr/local/lib/python3.7/site-packages/telegram/utils/request.py", line 209, in _request_wrapper
raise NetworkError('urllib3 HTTPError {0}'.format(error))
telegram.error.NetworkError: urllib3 HTTPError ('Connection aborted.', timeout('The write operation timed out'))
如果上传21b的原子核物理 (修订版)_卢希庭 (2).txt
就能成功
@blue-bird1 看错误的话应该是超时了 python大文件下载还是有待调试emm
@milkice233 emm 现在的群文件文件名称没有 URL Decode,我记得 Bot API 应该是能更改文件名称的
@mochaaP 但是不能发送中文名的文件…所以只能URLEncode
@milkice233 请问现在是不是没有群文件下载功能?群友上传文件只显示文件信息:
想要提供一个群文件下载功能.看了一下http api列表没有这个功能.如果用web群空间下载的话, 需要提供群号和文件id, 文件id可以在事件里找到. 作者有什么好办法优雅实现么