| | |
| | | import javax.script.ScriptEngine;
|
| | | import javax.script.ScriptEngineManager;
|
| | |
|
| | | import org.apache.commons.httpclient.HttpClient;
|
| | | import org.apache.commons.httpclient.methods.PostMethod;
|
| | | import org.jsoup.Jsoup;
|
| | | import org.jsoup.nodes.Document;
|
| | | import org.jsoup.select.Elements;
|
| | |
| | | return imgList;
|
| | |
|
| | | }
|
| | | |
| | | |
| | | |
| | | public static List<Long> getRecommendGoodsId(Long id) {
|
| | | List<Long> list = new ArrayList<Long>();
|
| | | JSONObject params = new JSONObject();
|
| | | params.put("pageNo", 1);
|
| | | params.put("show_tags", 1);
|
| | | params.put("goods_id", id);
|
| | | params.put("app_name", "goods_detail");
|
| | | params.put("list_id", "goods_detail_HgfiMc");
|
| | | params.put("pdduid", StringUtil.Md5(System.currentTimeMillis() + ""));
|
| | |
|
| | | HttpClient client = new HttpClient();
|
| | | PostMethod pm = new PostMethod("https://mobile.yangkeduo.com/proxy/api/api/tesla/query");
|
| | | pm.setRequestHeader("User-Agent", "Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko");
|
| | | pm.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
| | | pm.setRequestHeader("Referer", "https://union.jd.com/proManager/index?pageNo=1&keywords=%E9%9E%8B%E5%AD%90");
|
| | | pm.setRequestBody(params.toString());
|
| | | try {
|
| | | client.executeMethod(pm);
|
| | | String result = pm.getResponseBodyAsString();
|
| | | JSONObject json = JSONObject.fromObject(result);
|
| | | JSONArray array = json.optJSONArray("data");
|
| | | if (array != null) {
|
| | | for (int i = 0; i < array.size(); i++) {
|
| | | list.add(array.optJSONObject(i).optLong("goods_id"));
|
| | | }
|
| | | }
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
|
| | | return list;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 搜索候选词
|
| | | * @param key
|
| | | * @return
|
| | | */
|
| | | public static List<String> suggestSearch(String key) {
|
| | | List<String> list = new ArrayList<>();
|
| | | if (StringUtil.isNullOrEmpty(key))
|