We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
`func Download(clt *core.Client, mediaId, filepath string) (written int64, err error) { file, err := os.Create(filepath) if err != nil { return } defer func() { file.Close() if err != nil { os.Remove(filepath) } }()
return DownloadToWriter(clt, mediaId, file)
}如上例,根据mediaId下载多媒体到文件,但微信的消息中,除了语音消息,其他多媒体消息是未知文件扩展名的,目前认为,可以根据mediaId获取文件扩展名的方法就是调用微信获取素材的API,其返回的HTTP头中含有文件扩展名(如jpeg):HTTP/1.1 200 OK Connection: close Content-Type: image/jpeg Content-disposition: attachment; filename="MEDIA_ID.jpg" Date: Sun, 06 Jan 2013 10:20:18 GMT Cache-Control: no-cache, must-revalidate Content-Length: 339721 curl -G "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID"` 但是这样意味着需要额外的调用,请问大家有遇到类似的问题吗?是怎么解决的?
如上例,根据mediaId下载多媒体到文件,但微信的消息中,除了语音消息,其他多媒体消息是未知文件扩展名的,目前认为,可以根据mediaId获取文件扩展名的方法就是调用微信获取素材的API,其返回的HTTP头中含有文件扩展名(如jpeg):
The text was updated successfully, but these errors were encountered:
No branches or pull requests
`func Download(clt *core.Client, mediaId, filepath string) (written int64, err error) {
file, err := os.Create(filepath)
if err != nil {
return
}
defer func() {
file.Close()
if err != nil {
os.Remove(filepath)
}
}()
}
如上例,根据mediaId下载多媒体到文件,但微信的消息中,除了语音消息,其他多媒体消息是未知文件扩展名的,目前认为,可以根据mediaId获取文件扩展名的方法就是调用微信获取素材的API,其返回的HTTP头中含有文件扩展名(如jpeg):
HTTP/1.1 200 OKConnection: close
Content-Type: image/jpeg
Content-disposition: attachment; filename="MEDIA_ID.jpg"
Date: Sun, 06 Jan 2013 10:20:18 GMT
Cache-Control: no-cache, must-revalidate
Content-Length: 339721
curl -G "https://api.weixin.qq.com/cgi-bin/media/get?access_token=ACCESS_TOKEN&media_id=MEDIA_ID"`
但是这样意味着需要额外的调用,请问大家有遇到类似的问题吗?是怎么解决的?
The text was updated successfully, but these errors were encountered: