admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
fanli/src/main/java/com/yeshi/fanli/util/goods/douyin/CSJCPSApiUtil.java
@@ -270,7 +270,7 @@
        //转链类型:1、抖⾳ deep link;2、抖
        //⾳⼆维码;3、抖⾳⼝令。
        //默认返回抖⾳deeplink
        data.put("share_type", "[1,2,3]");
        data.put("share_type", "[1,3,4]");
        String result = baseRequest("/product/link", data);
        System.out.println(result);
        JSONObject resultJson = JSONObject.fromObject(result);
@@ -281,6 +281,7 @@
        DYConvertResult bean = new DYConvertResult();
        bean.setDeeplink(dataJson.optString("dy_deeplink"));
        bean.setPassword(dataJson.optString("dy_password"));
        bean.setZlink(dataJson.optString("dy_zlink"));
        if (dataJson.optJSONObject("dy_qr_code") != null) {
            bean.setQrCode(dataJson.optJSONObject("dy_qr_code").optString("url"));
@@ -386,11 +387,34 @@
    }
    public static JSONObject parseCommand(String command) {
        JSONObject data = new JSONObject();
        data.put("command", command);
        String result = baseRequest("/command_parse", data);
        System.out.println(result);
        JSONObject resultJson = JSONObject.fromObject(result);
        if (resultJson.optInt("code") != 0) {
            return null;
        }
        JSONObject dataJson = resultJson.optJSONObject("data");
        return dataJson;
    }
    public static String parseProductId(String command) {
        JSONObject result = parseCommand(command);
        if (result != null) {
            if (result.optInt("command_type") == 1) {
                return result.optJSONObject("product_info").optString("product_id");
            }
        }
        return null;
    }
    public static void main(String[] args) throws Exception {
        DYGoodsDetail goods = CSJCPSApiUtil.goodsDetail(Long.parseLong("3610681443753307139"));
        DYConvertResult link = CSJCPSApiUtil.goodsConvert(goods.getDetail_url(), DYUtil.createFanLiExtraInfo(437032L),
                "");
        System.out.println(link);
        DYConvertResult result =   goodsConvert("https://v.douyin.com/iNTutNyn/","123","132");
        System.out.printf(result.toString());
    }