temu客户端程序
This commit is contained in:
commit
4aaf264e89
694 files changed
+263780
No files matched your search
@@ -0,0 +1,167 @@
|
||||
using AllBase.Model.Result;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Security;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Work.BLL.Collect
|
||||
{
|
||||
/// <summary>
|
||||
/// 抖音好物采集
|
||||
/// </summary>
|
||||
public class HaoWuCollectBLL
|
||||
{
|
||||
private static bool CheckValidationResult(object sender, object certificate, object chain, SslPolicyErrors errors) => true; // 总是接受
|
||||
|
||||
public static string getHtml_fxg_20201220(string url, string cookies, string ip = "")
|
||||
{
|
||||
string str = "";
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
while (num < 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = null;
|
||||
if (!url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.ProtocolVersion = HttpVersion.Version10;
|
||||
}
|
||||
request.Timeout = 25000;
|
||||
request.ReadWriteTimeout = 25000;
|
||||
request.Method = "Get";
|
||||
request.ContentType = "application/json; charset=utf-8";
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36";
|
||||
if ((DateTime.Now.Second % 5) == 0)
|
||||
{
|
||||
request.UserAgent = "com.ss.android.ugc.aweme/140001 (Linux; U; QuicVersion:47946d2a 2020-10-14)";
|
||||
}
|
||||
else if ((DateTime.Now.Second % 5) == 1)
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (iPad; CPU OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
|
||||
}
|
||||
else if ((DateTime.Now.Second % 5) == 2)
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3";
|
||||
}
|
||||
else if ((DateTime.Now.Second % 5) == 3)
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (Linux; Android 10; TAS-AL00 Build/HUAWEITAS-AL00; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/66.0.3359.126 MQQBrowser/6.2 TBS/045120 Mobile Safari/537.36 V1_AND_SQ_8.2.7_1334_YYB_D QQ/8.2.7.4410 NetType/WIFI WebP/0.3.0 Pixel/1080 StatusBarHeight/81 SimpleUISwitch/0";
|
||||
}
|
||||
else if ((DateTime.Now.Second % 5) == 4)
|
||||
{
|
||||
request.UserAgent = "Mozilla/5.0 (Linux; Android 6.0.1; Redmi Note 3 Build/MMB29M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/76.0.3809.89 Mobile Safari/537.36 T7/11.19 SP-engine/2.15.0 baiduboxapp/11.19.5.10 (Baidu; P1 6.0.1)";
|
||||
}
|
||||
request.Host = new Uri(url).Host;
|
||||
if (cookies.Trim() != "")
|
||||
{
|
||||
request.Headers.Add("Cookie", cookies);
|
||||
}
|
||||
request.Headers.Add("x-agw-info", "w6S2IHH6-wDuuvNtk2hidFD2MalfJTaURnf6XobYTqjSXcFmCxT79rJjYPudFSWQKnvYl1_OuIsDwtMtheGHihJf4OgPYQqcLNzPkIgpYAEbkfMAvBCAm1gY6uOq0Q_7DbfFOJAMQRGwDEkbVSLUxQSX5cc0hIkwhm36AUf0CflSXVno");
|
||||
request.Headers.Add("x-tt-logid", "2020122015563901002902921706016162");
|
||||
request.Headers.Add("x-tt-trace-host", "010c04b40779d7ea1251fcddf2faf54650937df4831d71a387846d4b65371bb93d891684d9895d083828b415698988c161a98e8e3579dfbba439a0f3317851b468507df11e82922352c8b013941f82ea53");
|
||||
request.Headers.Add("x-trans-level", "0");
|
||||
request.Headers.Add("x-tt-trace-tag", "id=3;cdn-cache=miss");
|
||||
char[] separator = new char[] { ':' };
|
||||
string[] strArray = ip.Split(separator);
|
||||
char[] chArray2 = new char[] { '.' };
|
||||
string[] strArray2 = ip.Split(chArray2);
|
||||
if (((ip.Trim() != "") && ((strArray.Length == 2) && (ip.IndexOf(".") > 0))) && (strArray2.Length == 4))
|
||||
{
|
||||
request.Proxy = new WebProxy(strArray[0], Convert.ToInt32(strArray[1].Trim()));
|
||||
}
|
||||
Encoding encoding = Encoding.Default;
|
||||
encoding = Encoding.UTF8;
|
||||
str = new StreamReader(((HttpWebResponse)request.GetResponse()).GetResponseStream(), encoding).ReadToEnd();
|
||||
num = 10;
|
||||
}
|
||||
catch
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
public static string getHtml(string url, string cookies, string encod = "")
|
||||
{
|
||||
string str = "";
|
||||
try
|
||||
{
|
||||
int num = 0;
|
||||
while (num < 3)
|
||||
{
|
||||
try
|
||||
{
|
||||
HttpWebRequest request = null;
|
||||
if (!url.StartsWith("https", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
}
|
||||
else
|
||||
{
|
||||
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(CheckValidationResult);
|
||||
request = WebRequest.Create(url) as HttpWebRequest;
|
||||
request.ProtocolVersion = HttpVersion.Version10;
|
||||
}
|
||||
request.Method = "Get";
|
||||
request.Referer = url;
|
||||
request.ContentType = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;";
|
||||
request.ContentType = "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3";
|
||||
request.UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36";
|
||||
request.Host = new Uri(url).Host;
|
||||
if (cookies.Trim() != "")
|
||||
{
|
||||
request.Headers.Add("Cookie", cookies);
|
||||
}
|
||||
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
|
||||
Encoding encoding = Encoding.Default;
|
||||
if (encod == "utf8")
|
||||
{
|
||||
encoding = Encoding.UTF8;
|
||||
}
|
||||
StreamReader reader = new StreamReader(response.GetResponseStream(), encoding);
|
||||
str = reader.ReadToEnd();
|
||||
try
|
||||
{
|
||||
reader.Close();
|
||||
response.Close();
|
||||
reader.Dispose();
|
||||
response = null;
|
||||
request = null;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
num = 10;
|
||||
}
|
||||
catch
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
return str;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user