Home > Net >  About spiders crawling the crawler c # 521 how to solve
About spiders crawling the crawler c # 521 how to solve

Time:10-10

I refer to information online said need to decrypt the js encryption, decryption with the two results into the cookie to request inside can get normal HTML

Problem a: how can I use the HTTP request code is returned to me as a result, now directly jump to catch the inside


Code:
Try
{
String htmlCode;
HttpWebRequest webRequest=(System.Net.HttpWebRequest) System.Net.WebRequest.Create (url);
WebRequest. Timeout=30000;
WebRequest. Method="GET";

SetHeaderValue (webRequest. Headers, "Host", "");//here
I will not show?SetHeaderValue (webRequest. Headers, "Connection", "keep alive -");
SetHeaderValue (webRequest. Headers, "cache-control", "Max - age=0");
SetHeaderValue (webRequest. Headers, "Upgrade - the Insecure - Requests", "1");
SetHeaderValue (webRequest. Headers, "the user-agent", "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36 ");
SetHeaderValue (webRequest. Headers, "Accept", "text/HTML, application/XHTML + XML, application/XML. Q=0.9, image/webp image/apng, */*; Q=0.8 ");
SetHeaderValue (webRequest. Headers, "Accept - the Encoding", "gzip, deflate");
SetHeaderValue (webRequest. Headers, "Accept - Language" and "useful - CN, useful; Q=0.9 ");

HttpWebResponse webResponse=(System.Net.HttpWebResponse) webRequest. The method GetResponse ();
If (webResponse. ContentEncoding. ToLower ()=="gzip")//if you use the gzip decompression first
{
Using (System. IO Stream streamReceive=webResponse. GetResponseStream ())
{
Using (var zipStream=
The new System.IO.Com pression. GZipStream (streamReceive, System.IO.Compression.Com pressionMode. Decompress))
{
Using (StreamReader sr=new System. IO. StreamReader (zipStream, Encoding. The Default))
{
HtmlCode=sr. ReadToEnd ();
}
}
}
}
The else
{
Using (System. IO Stream streamReceive=webResponse. GetResponseStream ())
{
Using (System. IO StreamReader sr=new System. IO. StreamReader (streamReceive, Encoding. The Default))
{
HtmlCode=sr. ReadToEnd ();
}
}
}
Return htmlCode;
}
The catch (Exception e)
{
Return e. oString ();
}

How should I do to the result of online during the js, I went to get online request to test the site is to be able to return under the pursuing big brand of js code or send a request

CodePudding user response:

With the
The catch (WebException ex)
{
Res=(HttpWebResponse) ex. The Response;
}
Method to get back the 200 cases of response
And then use a js engines (such as V8) running the code you get
And then take parameters using the method of you said the request again

CodePudding user response:

The great god can send a code to see it the first js decoding out the second js don't know how

CodePudding user response:

The catch (WebException ex)
{
Res=(HttpWebResponse) ex. The Response;
}


Can indeed!!!!! Thank you!!!!!!

CodePudding user response:

Hello, problem solved?
  •  Tags:  
  • C#
  • Related