Skip to content

Commit

Permalink
PR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
dannyroosevelt committed Sep 8, 2024
1 parent 42c2300 commit 38be668
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion components/puppeteer/actions/common/common.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export default {
},
},
methods: {
async run({ $ }) {
normalizeUrl() {
let url = this.url;
if (!url.startsWith("http")) {
url = `https://${url}`;
Expand Down
3 changes: 2 additions & 1 deletion components/puppeteer/actions/get-html/get-html.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import puppeteer from "../../puppeteer.app.mjs";
import common from "../common/common.mjs";

export default {
...common,
key: "puppeteer-get-html",
name: "Get HTML",
description:
Expand All @@ -13,7 +14,7 @@ export default {
...common.props,
},
async run({ $ }) {
const url = await common.methods.run.call(this, { $ });
const url = this.normalizeUrl();
const browser = await this.puppeteer.launch();
const page = await browser.newPage();
await page.goto(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import puppeteer from "../../puppeteer.app.mjs";
import common from "../common/common.mjs";

export default {
...common,
key: "puppeteer-get-page-title",
name: "Get Page Title",
description:
Expand All @@ -13,7 +14,7 @@ export default {
...common.props,
},
async run({ $ }) {
const url = await common.methods.run.call(this, { $ });
const url = this.normalizeUrl();
const browser = await this.puppeteer.launch();
const page = await browser.newPage();
await page.goto(url);
Expand Down
3 changes: 2 additions & 1 deletion components/puppeteer/actions/get-pdf/get-pdf.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import common from "../common/common.mjs";
import fs from "fs";

export default {
...common,
key: "puppeteer-get-pdf",
name: "Get PDF",
description:
Expand Down Expand Up @@ -168,7 +169,7 @@ export default {
width: this.width,
};

const url = await common.methods.run.call(this, { $ });
const url = this.normalizeUrl();
const browser = await this.puppeteer.launch();
const page = await browser.newPage();
await page.goto(url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import fs from "fs";
import { ConfigurationError } from "@pipedream/platform";

export default {
...common,
key: "puppeteer-screenshot-page",
name: "Screenshot a Page",
description:
Expand Down Expand Up @@ -155,7 +156,7 @@ export default {
type: this.type,
};

const url = await common.methods.run.call(this, { $ });
const url = this.normalizeUrl();
const browser = await this.puppeteer.launch();
const page = await browser.newPage();
await page.goto(url);
Expand Down

0 comments on commit 38be668

Please sign in to comment.