Skip to content

Instantly share code, notes, and snippets.

View kevinchisholm's full-sized avatar

Kevin Chisholm kevinchisholm

View GitHub Profile
@kevinchisholm
kevinchisholm / scraper-api-ex-2-B.html
Last active October 17, 2020 23:28
Scraper API Example # 2 B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web Scraping Example</title>
</head>
<body>
<article id="main">
<p>This text was added with JavaScript.</p>
</article>
@kevinchisholm
kevinchisholm / scraper-api-ex-1-b.html
Last active August 29, 2020 20:52
Scraper API Example # 1 B
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Web Scraping Example</title>
</head>
<body>
<article id="main">
<p>I've been scraped!</p>
</article>
@kevinchisholm
kevinchisholm / scraper-api-ex-2-A.js
Last active August 29, 2020 20:51
Scraper API Example # 2 A
const scraperapiClient = require('scraperapi-sdk')(YOUR_API_KEY);
async function scrapePage(){
const scrapeUrl = 'http://examples.kevinchisholm.com/scrape-me/'
const scrapeResponse = await scraperapiClient.get(scrapeUrl, {render: true})
console.log(scrapeResponse);
}
scrapePage();
@kevinchisholm
kevinchisholm / scraper-api-ex-1-a.js
Last active August 29, 2020 20:48
Scraper API Example # 1 A
const scraperapiClient = require('scraperapi-sdk')(YOUR_API_KEY);
async function scrapePage(){
const scrapeUrl = 'http://examples.kevinchisholm.com/scrape-me/'
const scrapeResponse = await scraperapiClient.get(scrapeUrl)
console.log(scrapeResponse);
}
scrapePage();
@kevinchisholm
kevinchisholm / scraper-api-example-package.json
Created August 29, 2020 20:44
Scrape API Example #- package.json
{
"name": "scraper-api-example",
"version": "1.0.0",
"description": "Scraper API Example",
"main": "app.js",
"author": "Kevin Chisholm",
"license": "ISC",
"dependencies": {
"scraperapi-sdk": "^1.0.6"
}
module.exports.hats = async (event, context) => {
return {
statusCode: 200,
body: JSON.stringify({
message: 'This is the HATS endpiont.'
}),
};
};
module.exports.shoes = async (event, context) => {
service: my-service
plugins:
- serverless-domain-manager
provider:
name: aws
runtime: nodejs12.x
stage: ${opt:stage, "dev"}
{
"name": "create-a-custom-domain-name-for-your-aws-lambda",
"devDependencies": {
"serverless-domain-manager": "^3.3.1"
}
}
module.exports.getSecret = async (event, context) => {
return {
statusCode: 200,
body: JSON.stringify({
message: `Decrypted Secret: ${process.env.myApiKey}`
})
};
};