I am developing a simple node app to scraping html table from a website.
I am using cheerio (jquery in server side). I get the html from website and I select the table as below:
var express = require('express');
var fs = require('fs');
var request = require('request');
var cheerio = require('cheerio');
var app = express();
app.get('/scrape', function (req, res) {
url = 'http://ift.tt/18BZhy7';
request(url, function (error, response, html) {
if (!error) {
var $ = cheerio.load(html);
$('#yfncsumtab .yfnc_tableout1 tr td table')
(...)
The problem, comes here. If I test this jquery selector in the console it returns raw html: ...
But if I test in another html tables (with its proper ids/classes) from other websites it returns the html as an array: [ ... ]
In the firs case I neither cannot use .forEach() function to parse the table because is not an array, nor .toArray(), to convert to an array at least.
Is very strange for me... Any help?
This is the url: http://ift.tt/1AsPEaq
Is "https" (I have tried http and https in the url string, but without success.
Thanks
Aucun commentaire:
Enregistrer un commentaire