This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function currentNumbers(s, marker) { | |
let range = new RegExp(`.{1,${marker}}`, 'g') | |
return s.match(range); | |
} | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM node:10-alpine | |
WORKDIR /home/node/app | |
COPY package*.json ./ | |
RUN npm install | |
COPY . . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.isAwaitingReview = async function isAwaitingReview (context, page) { | |
return new Promise ((resolve, reject) => { | |
let currentUrl = await page.url() | |
if (currentUrl.indexOf('terms/unblock') > -1) { | |
const dialogButton = await page.$('[role=dialog]').$('button') | |
if (!dialogButton) { | |
return reject(page) | |
} | |
await dialogButton.click() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports.returnResponse = async function returnResponse (context, page, status) { | |
context.res = { | |
status, | |
body: await page.content(), | |
headers: { | |
"Content-Type": "text/html", | |
"Current-Page_Url": await page.url() | |
} | |
}; | |
return true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
const {returnResponse} = require('../utils') | |
module.exports = async function(context, req, pageCookiesIn) { | |
context.log("Started working function"); | |
if (!req.body || | |
!req.body.username || | |
!req.body.password) { | |
context.res = { | |
status: 400, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
module.exports = async function(context, req, pageCookiesIn) { | |
context.log("Started working function"); | |
if (!req.body || | |
!req.body.username || | |
!req.body.password) { | |
context.res = { | |
status: 400, | |
body: "Request Parameters not set // expecting {username: 'xxx', password: 'xxx'} in req.body" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
module.exports = async function(context, req) { | |
context.log("Started working function"); | |
if (!req.body || | |
!req.body.username || | |
!req.body.password) { | |
context.res = { | |
status: 400, | |
body: "Request Parameters not set // expecting {username: 'xxx', password: 'xxx'} in req.body" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
module.exports = async function (context, req) { | |
context.log("Started working function"); | |
if (!req.body || | |
!req.body.username || | |
!req.body.password) { | |
context.res = { | |
status: 400, | |
body: "Request Parameters not set // expecting {username: 'xxx', password: 'xxx'} in req.body" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require("puppeteer"); | |
module.exports = async function(context, req) { | |
context.log("Started working function"); | |
const browser = await puppeteer.connect({ | |
browserWSEndpoint: "ws://d.ixit.com.ng" | |
}); | |
const page = await browser.newPage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = async function (context, req) { | |
// keep ur module imports within | |
// this exported function | |
const Nightmare = require("nightmare"); | |
const nightmare = Nightmare() | |
// @returns Promise | |
let n = nightmare | |
.goto('https://duckduckgo.com') |