brave-real-browser-mcp-server 2.9.0 → 2.9.1
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.
|
@@ -140,14 +140,17 @@ export async function handleSentimentAnalysis(args) {
|
|
|
140
140
|
const { url, selector, text } = args;
|
|
141
141
|
try {
|
|
142
142
|
let contentToAnalyze = text;
|
|
143
|
-
|
|
143
|
+
// If no text provided, get from page
|
|
144
|
+
if (!contentToAnalyze) {
|
|
144
145
|
const page = getPageInstance();
|
|
145
146
|
if (!page) {
|
|
146
147
|
throw new Error('Browser not initialized. Call browser_init first.');
|
|
147
148
|
}
|
|
148
|
-
if
|
|
149
|
+
// Navigate if URL provided and different from current
|
|
150
|
+
if (url && page.url() !== url) {
|
|
149
151
|
await page.goto(url, { waitUntil: 'networkidle2', timeout: 30000 });
|
|
150
152
|
}
|
|
153
|
+
// Extract content from selector or entire page
|
|
151
154
|
if (selector) {
|
|
152
155
|
contentToAnalyze = await page.evaluate((sel) => {
|
|
153
156
|
const element = document.querySelector(sel);
|