RSS to Browserless to S3
@dylburger
code:
data:privatelast updated:5 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 1,000,000+ developers using the Pipedream platform
steps.
rss_trigger
inactive
last updated:-last event:-
steps.
take_screenshot
auth
(auths.browserless)
params
URL

Enter the URL you'd like to take a screenshot of here

 
https://example.com
string ·params.url
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
}
22
// See the browserless docs for more info:
// https://docs.browserless.io/
const puppeteer = require('puppeteer-core') 

const browser = await puppeteer.connect({ 
  browserWSEndpoint: `wss://chrome.browserless.io?token=${auths.browserless.api_key}` 
})
const page = await browser.newPage()

const { url } = params
await page.goto(url)
const screenshot = await page.screenshot()

// export the base64-encoded screenshot for use in future steps,
// along with the image type and filename
this.screenshot = Buffer.from(screenshot, 'binary').toString('base64')
this.type = "png"
this.filename = `${url.replace(/[&\/\\#, +()$~%.'":*?<>{}]/g, '_')}-${+new Date()}.${this.type}`

await browser.close()
steps.
upload_file_to_s3
Accepts a base64-encoded string, a filename, and a content type, then uploads as a file to S3
auth
(auths.aws)
params
S3 Bucket Name
 
string ·params.bucket
Content Type

MIME type of the content to upload, for S3 metadata

 
string ·params.ContentType
Filename

Filename with extension

 
test.html
string ·params.filename
Base64-encoded Data

A string of base64-encoded data, or a variable reference to that string

 
string ·params.data
code
async (params, auths) => {
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
}
20
const AWS = require("aws-sdk")

const { bucket, ContentType, filename, data } = params
const { accessKeyId, secretAccessKey } = auths.aws

const s3 = new AWS.S3({
  accessKeyId, 
  secretAccessKey,
})

const uploadParams = { 
  Bucket: bucket, 
  Key: filename, 
  Body: Buffer.from(data, 'base64'),
  ContentType,
}
this.S3Response = await s3.upload(uploadParams).promise()
console.log(`Uploaded file to S3!`)