Skip to content

Instantly share code, notes, and snippets.

@dhruvarora
Created January 10, 2017 07:08
Show Gist options
  • Save dhruvarora/16fa411a26938d5f056ac5f3b292f064 to your computer and use it in GitHub Desktop.
Save dhruvarora/16fa411a26938d5f056ac5f3b292f064 to your computer and use it in GitHub Desktop.
var request = require('request');
var cheerio = require('cheerio');
// var headers = {
// 'Pragma': 'no-cache',
// 'DNT': '1',
// 'Accept-Encoding': 'gzip, deflate, sdch',
// 'Accept-Language': 'en-US,en;q=0.8,ms;q=0.6',
// 'Accept': 'text/html, */*; q=0.01',
// 'Cache-Control': 'no-cache',
// 'X-Requested-With': 'XMLHttpRequest',
// 'Connection': 'keep-alive',
// 'Referer': 'http://www.bseindia.com/stock-share-price/bharti-airtel-ltd/bhartiartl/532454/',
// 'Cookie': 'statstabs=0; detabs=0; marktestat=0; expandable=0c; gettabs=0'
// };
var options = {
url: 'http://www.bseindia.com/stock-share-price/SiteCache/IrBackupStockReach.aspx?scripcode=532712&DebtFlag=C',
// headers: headers
};
function callback(error, response, body) {
if (!error && response.statusCode == 200) {
$ = cheerio.load(body);
console.log($('tr').text());
}
}
request(options, callback);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment