Skip to content

Commit

Permalink
upgrade playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyek committed Jun 13, 2024
1 parent eeb02d3 commit 6aa21fc
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
4 changes: 3 additions & 1 deletion projects/scrape-txs/build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ RUN npm run build

# runner

FROM mcr.microsoft.com/playwright:v1.42.1-jammy
# https://mcr.microsoft.com/en-us/product/playwright/tags
# FROM mcr.microsoft.com/playwright:v1.42.1-jammy
FROM mcr.microsoft.com/playwright:v1.44.1-jammy

RUN apt-get update && \
apt-get install -y \
Expand Down
28 changes: 8 additions & 20 deletions projects/scrape-txs/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion projects/scrape-txs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"lodash": "^4.17.21",
"nodemailer": "^6.9.13",
"pg": "^8.11.3",
"playwright": "1.41.1",
"playwright": "1.44.1",
"playwright-aws-lambda": "^0.10.0",
"ts-pattern": "^5.0.8",
"zod": "^3.22.4"
Expand Down
44 changes: 22 additions & 22 deletions projects/scrape-txs/src/lib/bac-gt/scrape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,28 +49,28 @@ export async function bacGtScrape({
// 'Sec-Fetch-User': '?1',
// 'Upgrade-Insecure-Requests': '1',
// });
await page.route(/https:\/\/www.baccredomatic.com\/$/, async (route) => {
if (route.request().resourceType() === 'document') {
const headers = Object.assign(route.request().headers(), {
Accept:
'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
'Accept-Encoding': 'gzip, deflate, br, zstd',
'Accept-Language': 'en-US,en;q=0.9',
'Sec-Ch-Ua':
'"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
'Sec-Ch-Ua-Mobile': '?0',
'Sec-Ch-Ua-Platform': '"macOS"',
'Sec-Fetch-Dest': 'document',
'Sec-Fetch-Mode': 'navigate',
'Sec-Fetch-Site': 'none',
'Sec-Fetch-User': '?1',
'Upgrade-Insecure-Requests': '1',
});
await route.continue({ headers });
} else {
await route.continue();
}
});
// await page.route(/https:\/\/www.baccredomatic.com\/$/, async (route) => {
// if (route.request().resourceType() === 'document') {
// const headers = Object.assign(route.request().headers(), {
// Accept:
// 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
// 'Accept-Encoding': 'gzip, deflate, br, zstd',
// 'Accept-Language': 'en-US,en;q=0.9',
// 'Sec-Ch-Ua':
// '"Google Chrome";v="125", "Chromium";v="125", "Not.A/Brand";v="24"',
// 'Sec-Ch-Ua-Mobile': '?0',
// 'Sec-Ch-Ua-Platform': '"macOS"',
// 'Sec-Fetch-Dest': 'document',
// 'Sec-Fetch-Mode': 'navigate',
// 'Sec-Fetch-Site': 'none',
// 'Sec-Fetch-User': '?1',
// 'Upgrade-Insecure-Requests': '1',
// });
// await route.continue({ headers });
// } else {
// await route.continue();
// }
// });
await page.goto('https://www.baccredomatic.com/');
await waitRandomMs();
await page
Expand Down

0 comments on commit 6aa21fc

Please sign in to comment.