* chore(deps-dev): bump eslint-plugin-unicorn from 71.1.0 to 72.0.0 Bumps [eslint-plugin-unicorn](https://github.com/sindresorhus/eslint-plugin-unicorn) from 71.1.0 to 72.0.0. - [Release notes](https://github.com/sindresorhus/eslint-plugin-unicorn/releases) - [Commits](https://github.com/sindresorhus/eslint-plugin-unicorn/compare/v71.1.0...v72.0.0) --- updated-dependencies: - dependency-name: eslint-plugin-unicorn dependency-version: 72.0.0 dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com> * style: fix prefer-dom-node-html-methods * style: fix prefer-split-limit * style: fix no-unnecessary-string-trim * style: fix no-multiple-promise-resolver-calls * style: add v72 preset --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: TonyRL <TonyRL@users.noreply.github.com>
22 lines
711 B
TypeScript
22 lines
711 B
TypeScript
import playwright from '@/utils/playwright';
|
|
|
|
const baseURL = 'https://alternativeto.net';
|
|
|
|
const playwrightGet = (url, cache) =>
|
|
cache.tryGet(url, async () => {
|
|
const context = await playwright();
|
|
const page = await context.newPage();
|
|
await page.route('**/*', (route) => {
|
|
const request = route.request();
|
|
request.resourceType() === 'document' ? route.continue() : route.abort();
|
|
});
|
|
await page.goto(url, {
|
|
waitUntil: 'domcontentloaded',
|
|
});
|
|
const html = await page.evaluate(() => document.documentElement.getHTML());
|
|
await context.close();
|
|
return html;
|
|
});
|
|
|
|
export { baseURL, playwrightGet };
|