ਵੈੱਬ ਨੂੰ ਕੈਪਚਰ ਅਤੇ ਕਨਵਰਟ ਕਰਨ ਲਈ ਟੂਲ

ਵੈਬਸਾਈਟਾਂ ਤੋਂ Node.js ਨਾਲ HTML ਟੇਬਲ ਕੈਪਚਰ ਕਰੋ

Node.js API

HTML ਟੇਬਲ ਬਦਲਣ ਦੇ ਕਈ ਤਰੀਕੇ ਹਨ into ਜੇ ਐਸ ਐੱਨ, ਸੀ ਐੱਸ ਵੀ ਅਤੇ ਐਕਸਲ ਸਪਰੈਡਸ਼ੀਟ ਵਰਤਦੇ ਹੋਏ ਗਰੈਬਜ਼ਿਟ ਦਾ ਨੋਡ.ਜਜ਼ ਏਪੀਆਈ, ਇੱਥੇ ਵਿਸਤ੍ਰਿਤ ਕੁਝ ਸਭ ਤੋਂ ਲਾਭਦਾਇਕ ਤਕਨੀਕਾਂ ਹਨ. ਪਰ ਤੁਹਾਨੂੰ ਸ਼ੁਰੂ ਕਰਨ ਤੋਂ ਪਹਿਲਾਂ ਯਾਦ ਰੱਖੋ ਕਿ ਫੋਨ ਕਰਨ ਤੋਂ ਬਾਅਦ url_to_table, html_to_table or file_to_table theੰਗ save or save_to ਟੇਬਲ ਨੂੰ ਹਾਸਲ ਕਰਨ ਲਈ methodੰਗ ਨੂੰ ਬੁਲਾਇਆ ਜਾਣਾ ਚਾਹੀਦਾ ਹੈ. ਜੇ ਤੁਸੀਂ ਜਲਦੀ ਦੇਖਣਾ ਚਾਹੁੰਦੇ ਹੋ ਕਿ ਇਹ ਸੇਵਾ ਤੁਹਾਡੇ ਲਈ ਸਹੀ ਹੈ ਜਾਂ ਨਹੀਂ, ਤੁਸੀਂ ਕੋਸ਼ਿਸ਼ ਕਰ ਸਕਦੇ ਹੋ HTML ਟੇਬਲ ਕੈਪਚਰ ਕਰਨ ਦਾ ਸਿੱਧਾ ਪ੍ਰਦਰਸ਼ਨ ਇੱਕ ਯੂਆਰਐਲ ਤੋਂ.

ਮੁ Optionsਲੇ ਚੋਣਾਂ

ਇਹ ਖਾਸ ਵਿਧੀ ਕਾਲ ਨਿਰਧਾਰਤ URL ਦੇ ਵੈਬਪੰਨੇ ਵਿੱਚ ਪਹਿਲੇ HTML ਟੇਬਲ ਨੂੰ ਬਦਲ ਦੇਵੇਗਾ, intਸੀਐਸਵੀ ਦਸਤਾਵੇਜ਼ ਇਹ ਕੋਡ ਸਨਿੱਪਟ ਕਿਸੇ ਖਾਸ ਵੈਬਪੰਨੇ ਜਾਂ HTML ਇਨਪੁਟ ਵਿੱਚ ਮਿਲੀ ਪਹਿਲੀ HTML ਟੇਬਲ ਨੂੰ ਬਦਲ ਦੇਵੇਗਾ intਸੀਐਸਵੀ ਦਸਤਾਵੇਜ਼

client.url_to_table("https://www.tesla.com");
//Then call the save or save_to method
client.html_to_table("<html><body><table><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>");
//Then call the save or save_to method
client.file_to_table("tables.html");
//Then call the save or save_to method

ਮੂਲ ਰੂਪ ਵਿੱਚ ਇਹ ਪਹਿਲੀ ਟੇਬਲ ਨੂੰ ਪਰਿਵਰਤਿਤ ਕਰੇਗਾ ਜਿਸਦੀ ਇਹ ਪਛਾਣ ਕਰਦਾ ਹੈ intਓਏ ਟੇਬਲ. ਹਾਲਾਂਕਿ ਇੱਕ ਵੈੱਬ ਪੇਜ ਵਿੱਚ ਦੂਜੀ ਟੇਬਲ ਨੂੰ ਇੱਕ 2 ਪਾਸ ਕਰਕੇ ਤਬਦੀਲ ਕੀਤਾ ਜਾ ਸਕਦਾ ਹੈ tableNumberToInclude ਜਾਇਦਾਦ

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"tableNumberToInclude":2};

client.url_to_table("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"tableNumberToInclude":2};

client.html_to_table("<html><body><table><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"tableNumberToInclude":2};

client.file_to_table("tables.html", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

ਤੁਸੀਂ ਇਹ ਵੀ ਨਿਰਧਾਰਤ ਕਰ ਸਕਦੇ ਹੋ targetElement ਪ੍ਰਾਪਰਟੀ ਜੋ ਨਿਸ਼ਚਤ ਕੀਤੇ ਐਲੀਮੈਂਟ ਆਈਡੀ ਦੇ ਅੰਦਰ ਸਿਰਫ ਟੇਬਲ ਨੂੰ ਪਰਿਵਰਤਿਤ ਕਰੇਗੀ.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"targetElement":"stocks_table"};

client.url_to_table("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"targetElement":"stocks_table"};

client.html_to_table("<html><body><table id='stocks_table'><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"targetElement":"stocks_table"};

client.file_to_table("tables.html", options);
//Then call the save or save_to method
client.save_to("result.csv", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

ਇਸ ਦੇ ਉਲਟ, ਤੁਸੀਂ ਵੈੱਬ ਪੇਜ 'ਤੇ ਸਾਰੇ ਟੇਬਲਾਂ ਨੂੰ ਸਹੀ ਤੇ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ includeAllTables ਪ੍ਰਾਪਰਟੀ, ਹਾਲਾਂਕਿ ਇਹ ਸਿਰਫ JSON ਅਤੇ XLSX ਫਾਰਮੈਟਾਂ ਨਾਲ ਕੰਮ ਕਰੇਗੀ. ਇਹ ਵਿਕਲਪ ਤਿਆਰ ਕੀਤੀ ਸਪਰੈਡਸ਼ੀਟ ਵਰਕਬੁੱਕ ਦੇ ਅੰਦਰ ਹਰੇਕ ਟੇਬਲ ਨੂੰ ਇੱਕ ਨਵੀਂ ਸ਼ੀਟ ਵਿੱਚ ਪਾ ਦੇਵੇਗਾ.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format","xlsx","includeHeaderNames":true,"includeAllTables":true};

client.url_to_table("https://www.tesla.com", options);
//Then call the save or save_to method
client.save_to("result.xlsx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format","xlsx","includeHeaderNames":true,"includeAllTables":true};

client.html_to_table("<html><body><table><tr><th>Name</th><th>Age</th></tr>
    <tr><td>Tom</td><td>23</td></tr><tr><td>Nicola</td><td>26</td></tr>
    </table></body></html>", options);
//Then call the save or save_to method
client.save_to("result.xlsx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format","xlsx","includeHeaderNames":true,"includeAllTables":true};

client.file_to_table("tables.html", options);
//Then call the save or save_to method
client.save_to("result.xlsx", function (error, id){
    //this callback is called once the capture is downloaded
    if (error != null){
        throw error;
    }
});

HTML ਟੇਬਲ ਨੂੰ JSON ਵਿੱਚ ਬਦਲੋ

ਨੋਡ.ਜੇਜ਼ ਅਤੇ ਗਰੈਬਜ਼ ਦੀ ਵਰਤੋਂ ਕਰਕੇ ਤੁਸੀਂ HTML ਟੇਬਲ ਬਦਲ ਸਕਦੇ ਹੋ intਹੇ ਜੇ ਐਸ ਐੱਨ, ਬੱਸ ਨਿਰਧਾਰਤ ਕਰੋ json ਫਾਰਮੈਟ ਪੈਰਾਮੀਟਰ ਵਿੱਚ. ਜਿਵੇਂ ਕਿ ਇਕ ਵਾਰ ਹੇਠਾਂ ਦਿੱਤੀ ਉਦਾਹਰਣ ਵਿਚ ਦਿਖਾਇਆ ਗਿਆ ਹੈ save_to methodੰਗ ਮੁਕੰਮਲ ਹੋਣ ਤੇ comਨਫੁੱਲ ਫੰਕਸ਼ਨ ਨੂੰ JSON ਨਾਲ ਬੁਲਾਇਆ ਜਾਂਦਾ ਹੈ ਪਰਿਣਾਮ ਵੇਰੀਏਬਲ ਵਿਚ ਇਸਨੂੰ ਫੇਰ ਇਨਬਿਲਟ ਨੋਡ.ਜਸ ਦੁਆਰਾ ਪਾਰਸ ਕੀਤਾ ਜਾਂਦਾ ਹੈ. JSON.parse ਇੱਕ ਆਬਜੈਕਟ ਬਣਾਉਣ ਲਈ ਕਾਰਜ ਜੋ ਕਿ HTML ਟੇਬਲ ਨੂੰ ਦਰਸਾਉਂਦਾ ਹੈ.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"format","json","includeHeaderNames":true,"includeAllTables":true};
client.url_to_table("https://www.tesla.com", options);

client.save_to(null, function(error, result){
    if (result != null)
    {
        var tableObj = JSON.parse(result);
    }
});

ਕਸਟਮ ਪਛਾਣਕਰਤਾ

ਤੁਸੀਂ ਇੱਕ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਨੂੰ ਪਾਸ ਕਰ ਸਕਦੇ ਹੋ ਸਾਰਣੀ ਵਿੱਚ shownੰਗ ਜਿਵੇਂ ਹੇਠਾਂ ਦਰਸਾਏ ਗਏ ਹਨ, ਇਹ ਮੁੱਲ ਤਦ ਤੁਹਾਡੇ ਗਰੈਬਜ਼ ਨੋਡ.ਜੇਜ਼ ਹੈਂਡਲਰ ਨੂੰ ਵਾਪਸ ਕਰ ਦਿੱਤਾ ਜਾਵੇਗਾ. ਉਦਾਹਰਣ ਦੇ ਲਈ ਇਹ ਕਸਟਮ ਪਛਾਣਕਰਤਾ ਇੱਕ ਡੇਟਾਬੇਸ ਪਛਾਣਕਰਤਾ ਹੋ ਸਕਦਾ ਹੈ, ਜਿਸ ਨਾਲ ਸਕ੍ਰੀਨਸ਼ਾਟ ਨੂੰ ਕਿਸੇ ਵਿਸ਼ੇਸ਼ ਡਾਟਾਬੇਸ ਰਿਕਾਰਡ ਨਾਲ ਜੋੜਿਆ ਜਾ ਸਕਦਾ ਹੈ.

var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.url_to_table("https://www.tesla.com", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.html_to_table("<html><body><h1>Hello World!</h1></body></html>", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");

var options = {"customId":123456};

client.file_to_table("example.html", options);
//Then call the save method
client.save("http://www.example.com/handler", function (error, id){
    if (error != null){
        throw error;
    }
});