| | |
| | | |
| | | public class IqiYiNewAPI { |
| | | |
| | | public static int TYPE_DIANYING = 1; |
| | | public static int TYPE_DIANSHIJU = 2;//电视剧 |
| | | public static int TYPE_ZONGYI = 6;//综艺 |
| | | public static int TYPE_DONGMAN = 4;//动漫 |
| | | public final static int TYPE_DIANYING = 1; |
| | | public final static int TYPE_DIANSHIJU = 2;//电视剧 |
| | | public final static int TYPE_ZONGYI = 6;//综艺 |
| | | public final static int TYPE_DONGMAN = 4;//动漫 |
| | | |
| | | public static int TYPE_YULE = 7;//娱乐 |
| | | public static int TYPE_KEJI = 30;//科技 |
| | |
| | | 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; |
| | | } |
| | | |
| | | /** |
| | | * 获取更新的专辑 |
| | | * |
| | |
| | | } |
| | | |
| | | |
| | | 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 { |
| | |
| | | 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>() { |