| | |
| | | //转链类型: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); |
| | |
| | | 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")); |
| | |
| | | } |
| | | |
| | | |
| | | 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("3629012100619309031")); |
| | | 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()); |
| | | |
| | | } |
| | | |
| | | |