|
@@ -91,7 +91,7 @@ namespace molilian.core
|
|
|
public static bool IsAffLlink(string url)
|
|
public static bool IsAffLlink(string url)
|
|
|
{
|
|
{
|
|
|
Uri uri = new(url);
|
|
Uri uri = new(url);
|
|
|
- if (uri.Host.Equals("u.jd.com", StringComparison.OrdinalIgnoreCase))
|
|
|
|
|
|
|
+ if (uri.Host.Equals("`u.jd.com", StringComparison.OrdinalIgnoreCase))
|
|
|
{
|
|
{
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
@@ -103,7 +103,9 @@ namespace molilian.core
|
|
|
{
|
|
{
|
|
|
WebClientUtility client = new()
|
|
WebClientUtility client = new()
|
|
|
{
|
|
{
|
|
|
- AllowAutoRedirect = false
|
|
|
|
|
|
|
+ AllowAutoRedirect = false,
|
|
|
|
|
+ Referer = "http://www.jd.com",
|
|
|
|
|
+ Proxy = ProxyNodesCore.RandomOne()
|
|
|
};
|
|
};
|
|
|
var response = client.Request(url);
|
|
var response = client.Request(url);
|
|
|
if (!response.Successed) return null;
|
|
if (!response.Successed) return null;
|
|
@@ -125,30 +127,30 @@ namespace molilian.core
|
|
|
itemId = string.Empty;
|
|
itemId = string.Empty;
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(url)) return LinkTypeEnum.unknown;
|
|
if (string.IsNullOrEmpty(url)) return LinkTypeEnum.unknown;
|
|
|
- url = url.ToLower();
|
|
|
|
|
|
|
+ string lowerUrl = url.ToLower();
|
|
|
|
|
|
|
|
- if (url.StartsWith("https://u.jd.com") ||
|
|
|
|
|
- url.StartsWith("http://u.jd.com"))
|
|
|
|
|
|
|
+ if (lowerUrl.StartsWith("https://u.jd.com") ||
|
|
|
|
|
+ lowerUrl.StartsWith("http://u.jd.com"))
|
|
|
return LinkTypeEnum.other_aff;
|
|
return LinkTypeEnum.other_aff;
|
|
|
|
|
|
|
|
- if (url.StartsWith("https://lives.jd.com/") ||
|
|
|
|
|
- url.StartsWith("http://lives.jd.com/"))
|
|
|
|
|
|
|
+ if (lowerUrl.StartsWith("https://lives.jd.com/") ||
|
|
|
|
|
+ lowerUrl.StartsWith("http://lives.jd.com/"))
|
|
|
return LinkTypeEnum.live;
|
|
return LinkTypeEnum.live;
|
|
|
|
|
|
|
|
- if (url.StartsWith("https://h5.m.jd.com/active/faxian/video/index.html") ||
|
|
|
|
|
- url.StartsWith("http://h5.m.jd.com/active/faxian/video/index.html"))
|
|
|
|
|
|
|
+ if (lowerUrl.StartsWith("https://h5.m.jd.com/active/faxian/video/index.html") ||
|
|
|
|
|
+ lowerUrl.StartsWith("http://h5.m.jd.com/active/faxian/video/index.html"))
|
|
|
return LinkTypeEnum.video;
|
|
return LinkTypeEnum.video;
|
|
|
|
|
|
|
|
- if (url.StartsWith("https://eco.m.jd.com/content/dr_home/index.html") ||
|
|
|
|
|
- url.StartsWith("http://eco.m.jd.com/content/dr_home/index.html")) return LinkTypeEnum.profile;
|
|
|
|
|
|
|
+ if (lowerUrl.StartsWith("https://eco.m.jd.com/content/dr_home/index.html") ||
|
|
|
|
|
+ lowerUrl.StartsWith("http://eco.m.jd.com/content/dr_home/index.html")) return LinkTypeEnum.profile;
|
|
|
|
|
|
|
|
- if (url.StartsWith("https://3.cn") ||
|
|
|
|
|
- url.StartsWith("http://3.cn"))
|
|
|
|
|
|
|
+ if (lowerUrl.StartsWith("https://3.cn") ||
|
|
|
|
|
+ lowerUrl.StartsWith("http://3.cn"))
|
|
|
{
|
|
{
|
|
|
var target_url = GetDesiredUrl(url);
|
|
var target_url = GetDesiredUrl(url);
|
|
|
return GetLinkType(target_url, out desiredUrl, out itemId);
|
|
return GetLinkType(target_url, out desiredUrl, out itemId);
|
|
|
}
|
|
}
|
|
|
- if (url.Contains("jd.com"))
|
|
|
|
|
|
|
+ if (lowerUrl.Contains("jd.com"))
|
|
|
{
|
|
{
|
|
|
itemId = GetItemId(url);
|
|
itemId = GetItemId(url);
|
|
|
if (!string.IsNullOrEmpty(itemId)) return LinkTypeEnum.goods;
|
|
if (!string.IsNullOrEmpty(itemId)) return LinkTypeEnum.goods;
|