Skip to content

Commit

Permalink
feat(get-html): add dashlord to user-agent (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
revolunet authored May 30, 2024
1 parent 8951cc3 commit 4bb26f9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
9 changes: 9 additions & 0 deletions .github/workflows/get-html.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,18 @@ jobs:
run: |
ls -la
- uses: ./get-html
name: test some URL
with:
url: https://opentermsarchive.org
output: result.html
- shell: bash
run: |
cat result.html | grep Accessibilité
- uses: ./get-html
name: test user-agent
with:
url: https://httpbin.org/user-agent
output: user-agent.html
- shell: bash
run: |
cat user-agent.html | grep dashlord
3 changes: 2 additions & 1 deletion get-html/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const getHTML = async (url) => {
`--lang=${LANGUAGE}`,
],
});

const userAgent = await browser.userAgent();
let html = "";
try {
const page = await browser.newPage();
await page.setUserAgent(`${userAgent} - dashlord`);
await page.goto(url);
await page.waitForTimeout(5000); // wait some time, some SPA may load asynchronously (ex: angular)
const frame = await page.mainFrame();
Expand Down

0 comments on commit 4bb26f9

Please sign in to comment.