Merge pull request #940 from getmaxun/pre-release-31

chore: pre-release v0.0.31
This commit is contained in:
Karishma Shukla
2026-01-04 23:06:37 +05:30
committed by GitHub
3 changed files with 11 additions and 49 deletions

View File

@@ -1,6 +1,6 @@
{
"name": "maxun-core",
"version": "0.0.28",
"version": "0.0.29",
"description": "Core package for Maxun, responsible for data extraction",
"main": "build/index.js",
"typings": "build/index.d.ts",
@@ -30,7 +30,6 @@
"author": "Maxun",
"license": "AGPL-3.0-or-later",
"dependencies": {
"@cliqz/adblocker-playwright": "^1.31.3",
"@types/node": "22.7.9",
"cross-fetch": "^4.0.0",
"joi": "^17.6.0",

View File

@@ -1,6 +1,5 @@
/* eslint-disable no-await-in-loop, no-restricted-syntax */
import { ElementHandle, Page, PageScreenshotOptions } from 'playwright-core';
import { PlaywrightBlocker } from '@cliqz/adblocker-playwright';
import fetch from 'cross-fetch';
import path from 'path';
@@ -70,7 +69,7 @@ export default class Interpreter extends EventEmitter {
private log: typeof log;
private blocker: PlaywrightBlocker | null = null;
// private blocker: PlaywrightBlocker | null = null;
private cumulativeResults: Record<string, any>[] = [];
@@ -125,13 +124,13 @@ export default class Interpreter extends EventEmitter {
};
}
PlaywrightBlocker.fromLists(fetch, ['https://easylist.to/easylist/easylist.txt']).then(blocker => {
this.blocker = blocker;
}).catch(err => {
this.log(`Failed to initialize ad-blocker: ${err.message}`, Level.ERROR);
// Continue without ad-blocker rather than crashing
this.blocker = null;
})
// PlaywrightBlocker.fromLists(fetch, ['https://easylist.to/easylist/easylist.txt']).then(blocker => {
// this.blocker = blocker;
// }).catch(err => {
// this.log(`Failed to initialize ad-blocker: ${err.message}`, Level.ERROR);
// // Continue without ad-blocker rather than crashing
// this.blocker = null;
// })
}
/**
@@ -148,26 +147,6 @@ export default class Interpreter extends EventEmitter {
return this.isAborted;
}
private async applyAdBlocker(page: Page): Promise<void> {
if (this.blocker) {
try {
await this.blocker.enableBlockingInPage(page as any);
} catch (err) {
this.log(`Ad-blocker operation failed:`, Level.ERROR);
}
}
}
private async disableAdBlocker(page: Page): Promise<void> {
if (this.blocker) {
try {
await this.blocker.disableBlockingInPage(page as any);
} catch (err) {
this.log(`Ad-blocker operation failed:`, Level.ERROR);
}
}
}
// private getSelectors(workflow: Workflow, actionId: number): string[] {
// const selectors: string[] = [];
@@ -2210,12 +2189,6 @@ export default class Interpreter extends EventEmitter {
workflowCopy = this.removeSpecialSelectors(workflowCopy);
// apply ad-blocker to the current page
try {
await this.applyAdBlocker(p);
} catch (error) {
this.log(`Failed to apply ad-blocker: ${error.message}`, Level.ERROR);
}
const usedActions: string[] = [];
let selectors: string[] = [];
let lastAction = null;
@@ -2495,16 +2468,6 @@ export default class Interpreter extends EventEmitter {
}
}
// Clear ad-blocker resources
if (this.blocker) {
try {
this.blocker = null;
this.log('Ad-blocker resources cleared', Level.DEBUG);
} catch (error: any) {
this.log(`Error cleaning up ad-blocker: ${error.message}`, Level.WARN);
}
}
// Clear accumulated data to free memory
this.cumulativeResults = [];
this.namedResults = {};

View File

@@ -1,6 +1,6 @@
{
"name": "maxun",
"version": "0.0.30",
"version": "0.0.31",
"author": "Maxun",
"license": "AGPL-3.0-or-later",
"dependencies": {
@@ -54,7 +54,7 @@
"lodash": "^4.17.21",
"loglevel": "^1.8.0",
"loglevel-plugin-remote": "^0.6.8",
"maxun-core": "^0.0.28",
"maxun-core": "^0.0.29",
"minio": "^8.0.1",
"moment-timezone": "^0.5.45",
"node-cron": "^3.0.3",