Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gds

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gds - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

screenshot.png

40

index.js

@@ -5,11 +5,43 @@ var program_name = process.argv[0]; //value will be "node"

var second_value = process.argv[3]; //value will be "monkey"
const puppeteer = require("puppeteer") // Required to do the programmable browsering
const waitTillHTMLRendered = async (page, timeout = 30000) => {
const checkDurationMsecs = 1000;
const maxChecks = timeout / checkDurationMsecs;
let lastHTMLSize = 0;
let checkCounts = 1;
let countStableSizeIterations = 0;
const minStableSizeIterations = 3;
while(checkCounts++ <= maxChecks){
let html = await page.content();
let currentHTMLSize = html.length;
let bodyHTMLSize = await page.evaluate(() => document.body.innerHTML.length);
console.log('last: ', lastHTMLSize, ' <> curr: ', currentHTMLSize, " body html size: ", bodyHTMLSize);
if(lastHTMLSize != 0 && currentHTMLSize == lastHTMLSize)
countStableSizeIterations++;
else
countStableSizeIterations = 0; //reset the counter
if(countStableSizeIterations >= minStableSizeIterations) {
console.log("Page rendered fully..");
break;
}
lastHTMLSize = currentHTMLSize;
await page.waitFor(checkDurationMsecs);
}
};
async function start () {
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto("https://www.cheapoair.com/air/listing?&d1=EWR&r1=MCO&dt1=10/23/2021&d2=MCO&r2=EWR&dt2=10/26/2021&tripType=ROUNDTRIP&cl=ECONOMY&ad=1&se=0&ch=0&infs=0&infl=0&fpprice=57.8&dealrefid=Ref:j07AATxFXk-5DQnP5fbzOA")
await Promise.race([page.screenshot({path: 'screenshot.png', fullPage: true}), new Promise((resolve, reject) => setTimeout(reject, 30000))]);
const url = `https://www.cheapoair.com/air/listing?&d1=${process.argv[2]}&r1=${process.argv[3]}&dt1=${process.argv[4]}&tripType=ONEWAYTRIP&cl=ECONOMY&ad=1&se=0&ch=0&infs=0&infl=0`;
await page.goto(url, {'timeout': 30000, 'waitUntil':'load'});
await waitTillHTMLRendered(page)
const data = await page.content()
await page.screenshot({path: 'screenshot.png', fullPage: true})
console.log(first_value,second_value);
await browser.close();

@@ -16,0 +48,0 @@ }

2

package.json
{
"name": "gds",
"version": "0.1.0",
"version": "0.1.1",
"description": "Decentralized Travel Booking Engine (Autonomous GDS Spider aka Booking Bot)",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc