admin
2020-10-13 fc7a6634496066fe45dca8ea9832bdd2f7341db4
src/main/java/com/yeshi/buwan/iqiyi/IqiYiNewAPI.java
@@ -187,6 +187,16 @@
        return null;
    }
    public static IqiyiAlbum2 getAlbumOrVideoDetail(Long id) {
        List<Long> ids = new ArrayList<>();
        ids.add(id);
        List<IqiyiAlbum2> list = getAlbumOrVideoDetail(ids);
        if (list != null && list.size() > 0)
            return list.get(0);
        return null;
    }
    /**
     * 获取更新的专辑
     *
@@ -313,22 +323,62 @@
    }
    public static String getIdByUrl(String url) {
        Map<String, String> params = new HashMap<>();
        params.put("playurl", url);
        params.put("rec", "0");
        String result = baseRquest("http://expand.video.iqiyi.com/c/fb", params);
        System.out.println(result);
        if (!StringUtil.isNullOrEmpty(result)) {
            JSONObject object = JSONObject.fromObject(result);
            if (object != null) {
                if ("A00000".equalsIgnoreCase(object.optString("code"))) {// 成功
                    List<IqiyiAlbum2> albumList = new ArrayList<>();
                    JSONObject obj = object.optJSONObject("data");
                    return obj.optString("qipuId");
                }
            }
        }
        return null;
    }
    public static String getAidByUrl(String url) {
        Map<String, String> params = new HashMap<>();
        params.put("playurl", url);
        params.put("rec", "0");
        String result = baseRquest("http://expand.video.iqiyi.com/c/fb", params);
        System.out.println(result);
        if (!StringUtil.isNullOrEmpty(result)) {
            JSONObject object = JSONObject.fromObject(result);
            if (object != null) {
                if ("A00000".equalsIgnoreCase(object.optString("code"))) {// 成功
                    List<IqiyiAlbum2> albumList = new ArrayList<>();
                    JSONObject obj = object.optJSONObject("data");
                    return obj.optString("albumQipuId");
                }
            }
        }
        return null;
    }
    private static Gson gson = null;
    static class DoubleTypeAdapter implements JsonDeserializer<Double> {
        @Override
        public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
            if (json == null || json.getAsString().equalsIgnoreCase("")) {
                return 0.0;
            } else
                return Double.parseDouble(json.getAsString());
        }
    }
    private static Gson getGson() {
        if (gson == null)
            gson = new GsonBuilder()
                    .registerTypeAdapter(double.class, new JsonDeserializer<Double>() {
                        @Override
                        public Double deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
                            if (json == null || json.getAsString().equalsIgnoreCase("")) {
                                return 0.0;
                            } else
                                return Double.parseDouble(json.getAsString());
                        }
                    })
                    .registerTypeAdapter(double.class, new DoubleTypeAdapter())
                    .registerTypeAdapter(int.class, new JsonDeserializer<Integer>() {
                        @Override
                        public Integer deserialize(JsonElement json, Type typeOfT, JsonDeserializationContext context) throws JsonParseException {
@@ -350,7 +400,7 @@
                            if (data == null || data.equalsIgnoreCase("")) {
                                return null;
                            } else
                                return new Gson().fromJson(data, IqiyiAlbum2.StatisticsBean.class);
                                return new GsonBuilder().registerTypeAdapter(double.class, new DoubleTypeAdapter()).create().fromJson(data, IqiyiAlbum2.StatisticsBean.class);
                        }
                    })
                    .registerTypeAdapter(IqiyiAlbum2.VideoBean.class, new JsonDeserializer<IqiyiAlbum2.VideoBean>() {