| | |
| | | }
|
| | |
|
| | | /**
|
| | | * |
| | | * @param auctionId
|
| | | * @return
|
| | | */
|
| | |
|
| | | public static List<ImageInfo> getTBDetailImageWithSizev2(Long auctionId) {
|
| | | List<ImageInfo> imgList = new ArrayList<>();
|
| | | try {
|
| | | String url = String.format("https://hws.m.taobao.com/cache/desc/5.0?id=" + auctionId);
|
| | | String result = HttpUtil.get(url);
|
| | | JSONObject data = JSONObject.fromObject(result);
|
| | |
|
| | | JSONArray array = data.optJSONObject("wdescContent").optJSONArray("pages");
|
| | | if (array != null) {
|
| | | String html = "";
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | String itemStr = array.optString(i).replace("<img", "<a").replace("</img>", "<a>");
|
| | | html += itemStr;
|
| | | }
|
| | | Document doc = Jsoup.parse(html);
|
| | | Elements items = doc.getElementsByTag("a");
|
| | | for (int i = 0; i < items.size(); i++) {
|
| | | ImageInfo img = new ImageInfo();
|
| | | Element item = items.get(i);
|
| | | if (StringUtil.isNullOrEmpty(item.attr("size")))
|
| | | continue;
|
| | | img.setWidth(Integer.parseInt(item.attr("size").split("x")[0]));
|
| | | img.setHeight(Integer.parseInt(item.attr("size").split("x")[1]));
|
| | | img.setPicture("http:" + item.ownText());
|
| | | imgList.add(img);
|
| | | }
|
| | | }
|
| | |
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | | return imgList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 阿里百川转链接口(暂时无法使用)
|
| | | *
|
| | | * @param auctionId
|