Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
keep calm and keep coding

abhinavKeshri07

💭
keep calm and keep coding
View GitHub Profile
@abhinavKeshri07
abhinavKeshri07 / scrape.js
Created Nov 25, 2019
this file shows you how to scrape data form a website. Thank me later.
View scrape.js
const cheerio = require('cheerio');
const fs = require('fs');
const readline = require('readline');
const get_post_data = require('./get_POST_data');
const get_get_data = require('./get_GET_data');
let callback_url = 'https://xyz.com';
// this form data object contain the query to be sent.
let form_data = {
@abhinavKeshri07
abhinavKeshri07 / get_POST_data.js
Created Nov 25, 2019
This file lets you make post request to any server running https or http with nodejs. You can modify the code send json data. Thank me later.
View get_POST_data.js
const https = require('https');
const http = require('http');
const querystring = require('querystring');
const url = require('url');
let get_POST_data = function(urlToPost, formData, headersToSend) {
return new Promise(function(resolve, reject) {
let parsed_url = url.parse(urlToPost);
let post_data = querystring.stringify(formData);
let secure = false;
@abhinavKeshri07
abhinavKeshri07 / get_GET_data.js
Created Nov 25, 2019
This file lets you make get request with nodejs to any server http or https. It minimal amount of correct headers for the get request to work. Thank me later.
View get_GET_data.js
const https = require('https');
const http = require('http');
const querystring = require('querystring');
const url = require('url');
let get_GET_data = function(urlToGET) {
return new Promise(function(resolve, reject) {
//console.log("get_GET_data was called");
urlToGET = urlToGET + "";
//console.log(urlToGET + " = url");
You can’t perform that action at this time.