| | |
| | | return taoBaoGoodsBrief;
|
| | | }
|
| | |
|
| | | public static String getGoodsIdByPhoneShareUrl(String burl) {
|
| | | try {
|
| | | Connection connect = Jsoup.connect(burl);
|
| | | Document document = connect.get();
|
| | | org.jsoup.nodes.Element element = document.getElementsByTag("head").get(0).getElementsByTag("Script")
|
| | | .get(1);
|
| | | String html = element.toString();
|
| | | int index = html.indexOf("var url = ");
|
| | | int endIndex = html.lastIndexOf("'");
|
| | | html = html.substring(index, endIndex);
|
| | | int index2 = html.indexOf("'");
|
| | | html = html.substring(index2 + 1);
|
| | | int indexId = html.indexOf("id=");
|
| | | String id = "";
|
| | | if (html.contains("a.m.taobao.com")) {
|
| | | indexId = html.indexOf("com/i");
|
| | | html = html.substring(indexId);
|
| | | html = html.substring(5, html.indexOf("."));
|
| | | id = html;
|
| | | } else {
|
| | | String reg = "[?|&]{1}[i]{1}[d]{1}[=]{1}\\d+[&]?";
|
| | | Pattern p = Pattern.compile(reg);
|
| | | Matcher matcher = p.matcher(html);
|
| | | if (matcher.find()) {
|
| | | id = matcher.group();
|
| | | }
|
| | | id = id.substring(id.indexOf("=") + 1, id.lastIndexOf("&"));
|
| | | }
|
| | | return id;
|
| | | } catch (Exception e) {
|
| | | LogHelper.error("无法解析到淘宝商品ID:" + burl);
|
| | | return null;
|
| | | }
|
| | | }
|
| | | |
| | | /**
|
| | | * 获取商品的用户分成比例
|
| | | *
|