|
|
@ -76,8 +76,9 @@ func (this *Seckill) getSeckillUrl() (string,error) { |
|
|
|
url := "" |
|
|
|
for { |
|
|
|
_, body, _ := req.SetUrl("https://itemko.jd.com/itemShowBtn?callback=jQuery{}" + strconv.Itoa(common.Rand(1000000, 9999999)) + "&skuId=" + skuId + "&from=pc&_=" + strconv.Itoa(int(time.Now().Unix()*1000))).SetMethod("get").Send().End() |
|
|
|
if gjson.Get(body,"url").Exists() && gjson.Get(body,"url").String()!="" { |
|
|
|
url=gjson.Get(body,"url").String() |
|
|
|
urlbody := strings.Trim(strings.Split(body, "(")[1], ")") |
|
|
|
if gjson.Get(urlbody, "url").Exists() && gjson.Get(urlbody, "url").String() != "" { |
|
|
|
url = gjson.Get(urlbody, "url").String() |
|
|
|
break |
|
|
|
} |
|
|
|
log.Println("抢购链接获取失败,稍后自动重试") |
|
|
|