@opentermsarchive/engine 5.6.1 → 5.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -20,6 +20,11 @@ export default async function fetch(url, cssSelectors, config) {
|
|
|
20
20
|
await page.setDefaultNavigationTimeout(config.navigationTimeout);
|
|
21
21
|
await page.setExtraHTTPHeaders({ 'Accept-Language': config.language });
|
|
22
22
|
|
|
23
|
+
await page.setCacheEnabled(false); // Disable cache to ensure fresh content on each fetch and prevent stale data from previous requests
|
|
24
|
+
const client = await page.target().createCDPSession();
|
|
25
|
+
|
|
26
|
+
await client.send('Network.clearBrowserCookies'); // Clear cookies to ensure clean state between fetches and prevent session persistence across different URLs
|
|
27
|
+
|
|
23
28
|
response = await page.goto(url, { waitUntil: 'load' }); // Using `load` instead of `networkidle0` as it's more reliable and faster. The 'load' event fires when the page and all its resources (stylesheets, scripts, images) have finished loading. `networkidle0` can be problematic as it waits for 500ms of network inactivity, which may never occur on dynamic pages and then triggers a navigation timeout.
|
|
24
29
|
|
|
25
30
|
if (!response) {
|