Aauto captures http data and aauto captures data

Source: Internet
Author: User

Aauto captures http data and aauto captures data

Description: A simple example of using a kuaishou to capture data on a webpage.

Example: I want to capture the data of a website and save it in the database.

Procedure1. Open SQL, create a new database Test, and create a new table test.

2. Open the kuaishou. Prepare to capture data. Take this example 3366nbedi.com/pre_bsq/para/zuanghuogang.asp. I want to capture the data of this table.

Import console; import inet. whttp; import web. mshtml; import sqlServer; var db, err = sqlServer (server = ". "; database =" Test "; uid =" sa "; pwd =" 123 ";) assert (db, err); var http = inet. whttp (); var url = "http://www.nbedi.com/pre_bsq/para/zuanghuogang.asp"; var str = http. get (url); str = string. save ("f: \ test.txt", str); // save it to the local var str = string. load ("f: \ test.txt"); // read var html = web. mshtml (); // generate the parser html. write (str); // parse the variable Text var eles = html. queryEles (tagName = "table"); console. log (eles [1]. rows. length); for (I = 1; eles [1]. rows. length-1) {var pnamec = eles [1]. rows (I ). cells (0 ). innerText; var pnamee = eles [1]. rows (I ). cells (1 ). innerText; var ccodes = eles [1]. rows (I ). cells (2 ). innerText; var using c ("insert into test (pnamec, pnamee, ccodes, pcodes) VALUES (@ pnamec, @ pnamee, @ ccodes, @ pcodes)", {pnamec = pnamec; pnamee = pnamee; ccodes = ccodes; pcodes = pcodes; // write to database})} console. pause (true );
OK.



What is AAuto?

A hodgedge, the cottage version, has no future. Besides, it's all about programming in English. Learn how good C #, GO, JAVA, and Python are. You're on the wrong path, bro.

How to Use AAuto_Quicker

Shortcut Key Ctrl + J display code prompt, shortcut key Ctrl + K refresh smart prompt data 2 open kuaishou help document 3 You can try other programming languages in AAuto

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.