The crawler encounters the problem that the webpage is reload. reload

Source: Internet
Author: User

The crawler encounters the problem that the webpage is reload. reload

Some websites will add this. window. location. reload () to the page for anti-collection. At this time, you will get the following code:

<Html>
<Head>
<Meta http-equiv = "Content-Type" content = "text/html; charset = UTF-8">
</Head>
<Body>
<Iframe height = "0" width = "0" style = "border: 0px;" src = "http: // www. ***. cn/*** _cookie.html "> </iframe>
<Script type = "text/javascript">
SetTimeout (function (){
This. window. location. reload ();
},1000 );
</Script> </body>
</Html>

In this way, you will not be able to get the content of his webpage, but the browser can display it normally.

At this time, you need to add a cookie when crawling. The more direct one is to add the cookie when accessing the browser statically. You can also Dynamically Retrieve the cookie Based on the address (I have not tried dynamic retrieval)


How does a web crawler extract regular expressions of web page information or use a third-party toolkit?
Example html parser jsoup
Jsoup is recommended for use with powerful functions. For more information, see
Http://zhidao.baidu.com/question/552336025? & Amp; oldq = 1 # answer-1391273085
Send me a private email if you have any questions
I want to create a web crawler for the problem that the webpage source code does not correspond to the webpage content. However, the crawled data is not the current page information. For more information, see the URL format and code it, example: "url? Url = ..."

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.