'Node JS to scrape table with table-scraper but failed
I am new to NodeJS. I want to scrape table(s) from a page with the package table-scraper but failed, can anyone help me out? My code is as follows:
var http = require('http');
var scraper = require('table-scraper');
scraper
.get('https://en.wikipedia.org/wiki/List_of_countries_by_GDP_(nominal)_per_capita')
.then(function(tableData) {
});
http.createServer(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end(`<p>tableData</p><p> ${tableData} </p>`);
}).listen(8080);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
