ওয়েব ক্যাপচার এবং রূপান্তর করার সরঞ্জামসমূহ

নোড.জেএস দিয়ে ওয়েবসাইটগুলি থেকে এইচটিএমএল টেবিলগুলি ক্যাপচার করুন

নোড.জেএসপিআইপি

এইচটিএমএল টেবিল রূপান্তর করার একাধিক উপায় রয়েছে into জেএসএন, সিএসভি এবং এক্সেল স্প্রেডশিট ব্যবহার করে গ্র্যাজআইটি'র নোড.জেএসআইপিআই, বিশদটি এখানে বেশ কয়েকটি দরকারী কৌশল রয়েছে। তবে আপনি শুরু করার আগে মনে রাখবেন যে ফোন করার পরে url_to_table, html_to_table or file_to_table পদ্ধতিগুলি save or save_to টেবিলটি ক্যাপচারের জন্য পদ্ধতিটি কল করতে হবে। আপনি যদি এই পরিষেবাটি আপনার জন্য উপযুক্ত কিনা তা দ্রুত দেখতে চান তবে আপনি এটিকে চেষ্টা করতে পারেন এইচটিএমএল টেবিলগুলি ক্যাপচারের লাইভ ডেমো একটি ইউআরএল থেকে।

বেসিক বিকল্পসমূহ

এই নির্দিষ্ট পদ্ধতির কলটি নির্দিষ্ট URL এর ওয়েবপৃষ্ঠায় প্রথম এইচটিএমএল টেবিলকে রূপান্তর করবে, intওএসএসভি ডকুমেন্ট এই কোড স্নিপেট একটি নির্দিষ্ট ওয়েবপৃষ্ঠা বা এইচটিএমএল ইনপুটটিতে পাওয়া প্রথম এইচটিএমএল টেবিলকে রূপান্তর করবে 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;
    }
});

এইচটিএমএল টেবিলগুলি JSON এ রূপান্তর করুন

নোড.জেএস এবং গ্র্যাবিজ ব্যবহার করে আপনি এইচটিএমএল টেবিলগুলি রূপান্তর করতে পারেন intহে জেএসন, কেবল উল্লেখ করুন json বিন্যাস প্যারামিটারে। নীচের উদাহরণে একবার হিসাবে দেখানো হয়েছে save_to পদ্ধতিটি সমাপ্ত হয় অনম্পূর্ণ ফাংশনটিকে JSON এর সাথে ফলাফল ভেরিয়েবল বলা হয় এটি পরে ইনবিল্ট নোড.জেএস দ্বারা পার্স করা হয় JSON.parse এইচটিএমএল টেবিল উপস্থাপন করে এমন একটি বস্তু তৈরি করতে ফাংশন।

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);
    }
});

কাস্টম আইডেন্টিফায়ার

আপনি একটি কাস্টম সনাক্তকারী পাস করতে পারেন টেবিল পদ্ধতিগুলি নীচে দেখানো হয়েছে, এই মানটি আপনার গ্র্যাবজিট নোড.জেএস হ্যান্ডলারের কাছে ফিরে আসে। উদাহরণস্বরূপ, এই কাস্টম শনাক্তকারী কোনও ডাটাবেস শনাক্তকারী হতে পারে, একটি স্ক্রিনশটকে একটি নির্দিষ্ট ডাটাবেস রেকর্ডের সাথে যুক্ত করার অনুমতি দেয়।

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;
    }
});