NutzCN Logo
问答 使用的1.r.59版本,通过接口上传微信视频不审核
发布于 2475天前 作者 qq_d6c9c504 1807 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk
 @Override
    public WxResp add_video(File f, String title, String introduction) {
        if (f == null)
            throw new NullPointerException("meida file is NULL");
        String url = String.format("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=%s", getAccessToken());
        Request req = Request.create(url, METHOD.POST);
        req.getParams().put("media", f);
        req.getParams().put("description",
                Json.toJson(new NutMap().setv("title", title).setv("introduction", introduction),
                        JsonFormat.compact().setQuoteName(true)));
        Response resp = new FilePostSender(req).send();
        if (!resp.isOK())
            throw new IllegalStateException("add_material, resp code=" + resp.getStatus());
        return Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
    }

调用的是这个代码上传视频,上传到微信的视频永久不审核。

8 回复

换新版吧,也许api变了

 @Override
    public WxResp add_video(File f, String title, String introduction) {
        if (f == null)
            throw new NullPointerException("meida file is NULL");
        String url = String.format("https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=%s", getAccessToken());
        Request req = Request.create(url, METHOD.POST);
        req.getParams().put("media", f);
        req.getParams().put("description",
                Json.toJson(new NutMap().setv("title", title).setv("introduction", introduction),
                        JsonFormat.compact().setQuoteName(true)));
        Response resp = new FilePostSender(req).send();
        if (!resp.isOK())
            throw new IllegalStateException("add_material, resp code=" + resp.getStatus());
        return Json.fromJson(WxResp.class, resp.getReader("UTF-8"));
    }

兽总,这是6.2版本的是的代码,看接口是一样的,代码也是一样的。

我看接口好像少了一个type参数
curl "https://api.weixin.qq.com/cgi-bin/material/add_material?access_token=ACCESS_TOKEN&type=TYPE" -F media=@media.file -F description='{"title":VIDEO_TITLE, "introduction":INTRODUCTION}'

哪部分没写??

type参数没加,好像会自动识别文件类型

噢,我改改

好了,提交了

添加回复
请先登陆
回到顶部