Browse Source

增加反爬虫

master
С·æ 4 years ago
parent
commit
1fc520e4dd
  1. 5
      JdShopListener/JdShopListener/MainWindowViewModel.cs

5
JdShopListener/JdShopListener/MainWindowViewModel.cs

@ -717,7 +717,7 @@ namespace JdShopListener
string html = http.GetStringAsync($"https://item.jd.com/{skuId}.html").Result; string html = http.GetStringAsync($"https://item.jd.com/{skuId}.html").Result;
if (html.Contains("passport.jd.com/new/login.aspx")) if (html.Contains("passport.jd.com/new/login.aspx")|| html.Contains("//item.jd.com/html/token.html?returnUrl="))
{ {
AddLog("登录失效,触发验证!!重新尝试获取登录状态"); AddLog("登录失效,触发验证!!重新尝试获取登录状态");
InitLoginCookie(); InitLoginCookie();
@ -741,6 +741,7 @@ namespace JdShopListener
} }
catch (Exception ex) catch (Exception ex)
{ {
AddLog("获取sku详情信息失败:" + ex.Message);
return null; return null;
} }
} }
@ -1053,7 +1054,7 @@ namespace JdShopListener
JDCookie += $"{c.Name}={c.Value};"; JDCookie += $"{c.Name}={c.Value};";
}); });
AddLog("获取到Cookie" + JDCookie);
} }
} }

Loading…
Cancel
Save