| | |
| | | /** |
| | | * 搜索网页 |
| | | * |
| | | * @param searchFilter |
| | | * @param skuId |
| | | * @return |
| | | */ |
| | | @SuppressWarnings("deprecation") |
| | |
| | | /** |
| | | * 计算商品券后价,没有券则返回原价 |
| | | * |
| | | * @param goodsBrief |
| | | * @param jdGoods |
| | | * @return |
| | | */ |
| | | public static BigDecimal getQuanPrice(JDGoods jdGoods) { |
| | | public static BigDecimal getCouponPrice(JDGoods jdGoods) { |
| | | BigDecimal price = null; |
| | | JDPingouInfo pinGouInfo = jdGoods.getPinGouInfo(); |
| | | if (pinGouInfo == null) { |
| | |
| | | } catch (Exception e) { |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public static boolean isJDLink(String url) { |
| | | return url.startsWith("https://item.m.jd.com/product/") || url.startsWith("http://item.m.jd.com/product/") |
| | | || url.startsWith("https://item.jd.com/") || url.startsWith("http://item.jd.com/")||url.startsWith("https://u.jd.com/")||url.startsWith("https://3.cn/"); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | public static String getJDGoodsIdByUJD(String url) { |
| | | if(url.startsWith("https://3.cn/")){ |
| | | try { |
| | | Document doc = Jsoup.connect(url).get(); |
| | | String location = doc.location(); |
| | | if (location.startsWith("https://cfe.m.jd.com/privatedomain/")) { |
| | | Map<String, String> params = HttpUtil.getPramsFromUrl(location); |
| | | String returnurl = params.get("returnurl"); |
| | | returnurl = URLDecoder.decode(returnurl, "UTF-8"); |
| | | return parseJDSkuIdByUrl(returnurl); |
| | | } else { |
| | | return parseJDSkuIdByUrl(location); |
| | | } |
| | | }catch(Exception e){ |
| | | |
| | | } |
| | | } |
| | | |
| | | try { |
| | | String body = HttpUtil.get(url); |
| | | Document doc = Jsoup.parse(body); |
| | |
| | | /** |
| | | * 查询天猫商品图片、标题 |
| | | * |
| | | * @param auctionId |
| | | * @param goodsId |
| | | * @return |
| | | */ |
| | | public static JDGoods getSimpleGoodsInfo(String goodsId) { |
| | |
| | | return urlList; |
| | | } |
| | | |
| | | |
| | | public static String getMaterialId(String id){ |
| | | if(NumberUtil.isNumeric(id)){ |
| | | return String.format("https://item.jd.com/%s.html", id); |
| | | }else{ |
| | | return String.format("https://jingfen.jd.com/detail/%s.html", id); |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) throws IOException { |
| | | System.out.printf(getJDGoodsIdByUJD("https://3.cn/297ndx-c")); |
| | | } |
| | | |
| | | } |