|
@@ -51,81 +51,7 @@ public class TaobaoJhsbybtServiceImpl implements TaobaoJhsbybtService {
|
|
|
String sign = DigestUtils.md5Hex(token + "&" + paramMap.get("t") + "&" + paramMap.get("appKey") + "&" + paramMap.get("data"));
|
|
|
paramMap.put("sign", sign);
|
|
|
headerMap.put("Cookie", cookie);
|
|
|
-// System.out.println(cookie);
|
|
|
result = HttpUtils.httpGet(url, paramMap, headerMap);
|
|
|
return result;
|
|
|
}
|
|
|
-
|
|
|
- public static void main(String[] args) {
|
|
|
- try {
|
|
|
- PrintStream out = new PrintStream("D:/bybt0929.csv");
|
|
|
- System.setOut(out);
|
|
|
- } catch (FileNotFoundException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- System.out.println("商品id,商品名,销量,商品logo,设计图,商品图,商品链接,正常价,,,补贴价,补贴券");
|
|
|
-
|
|
|
- TaobaoJhsbybtServiceImpl tb = new TaobaoJhsbybtServiceImpl();
|
|
|
- int i = 1;
|
|
|
- Boolean hasMore = true;
|
|
|
- while (hasMore) {
|
|
|
- try {
|
|
|
- String result = tb.getGoodsList(i);
|
|
|
- result = result.replace("mtopjsonp2(", "");
|
|
|
- result = result.substring(0, result.length() - 1);
|
|
|
- ObjectMapper mapper = new ObjectMapper();
|
|
|
- JsonNode rootNode = mapper.readTree(result);
|
|
|
-// System.out.println(HttpUtils.COOKIESTORE.toString());
|
|
|
-// System.out.println(result);
|
|
|
- Boolean success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
|
|
|
- while (!success) {
|
|
|
- Thread.sleep(3000L);
|
|
|
- result = tb.getGoodsList(i);
|
|
|
- result = result.replace("mtopjsonp2(", "");
|
|
|
- result = result.substring(0, result.length() - 1);
|
|
|
- mapper = new ObjectMapper();
|
|
|
- rootNode = mapper.readTree(result);
|
|
|
- success = rootNode.get("data").get("resultValue").get("8613423").get("success").asBoolean();
|
|
|
- }
|
|
|
- hasMore = rootNode.get("data").get("resultValue").get("8613423").get("data").get("hasMore").asBoolean();
|
|
|
- Iterator<JsonNode> items = rootNode.get("data").get("resultValue").get("8613423").get("data").get("items").iterator();
|
|
|
- while (items.hasNext()) {
|
|
|
- JsonNode itemNode = items.next();
|
|
|
- String cjmsItemName = itemNode.get("cjmsItemName").asText();
|
|
|
- String itemSoldInfo = itemNode.get("itemSoldInfo").asText();
|
|
|
- String picUrl = itemNode.get("picUrl").asText();
|
|
|
- String cjmsTaobaoEntrance = itemNode.get("cjmsTaobaoEntrance").asText();
|
|
|
- String couponAmount = itemNode.get("couponAmount").asText();
|
|
|
- String orgPrice = itemNode.get("orgPrice").asText();
|
|
|
- String brandLogo = itemNode.get("brandLogo").asText();
|
|
|
- String couponPrice = itemNode.get("couponPrice").asText();
|
|
|
- String actPrice = itemNode.get("actPrice").asText();
|
|
|
- String cutPrice = itemNode.get("cutPrice").asText();
|
|
|
- String itemUrl = itemNode.get("itemUrl").asText();
|
|
|
- String itemId = itemNode.get("itemId").asText();
|
|
|
- System.out.println(itemId+","+cjmsItemName+","+
|
|
|
- itemSoldInfo+","+
|
|
|
- brandLogo+","+
|
|
|
- picUrl+","+
|
|
|
- cjmsTaobaoEntrance+","+
|
|
|
- itemUrl+","+
|
|
|
- actPrice+","+
|
|
|
- cutPrice+","+
|
|
|
- orgPrice+","+
|
|
|
- couponPrice+","+
|
|
|
- couponAmount);
|
|
|
- }
|
|
|
- i++;
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- try {
|
|
|
- Thread.sleep(3000L);
|
|
|
- } catch (InterruptedException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
}
|