Merge branch 'develop' into browser-service
This commit is contained in:
@@ -658,6 +658,16 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[
|
||||
};
|
||||
}
|
||||
|
||||
browser = browserPool.getRemoteBrowser(plainRun.browserId);
|
||||
if (!browser) {
|
||||
throw new Error('Could not access browser');
|
||||
}
|
||||
|
||||
let currentPage = await browser.getCurrentPage();
|
||||
if (!currentPage) {
|
||||
throw new Error('Could not create a new page');
|
||||
}
|
||||
|
||||
if (recording.recording_meta.type === 'scrape') {
|
||||
logger.log('info', `Executing scrape robot for API run ${id}`);
|
||||
|
||||
@@ -686,13 +696,13 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[
|
||||
|
||||
// Markdown conversion
|
||||
if (formats.includes('markdown')) {
|
||||
markdown = await convertPageToMarkdown(url);
|
||||
markdown = await convertPageToMarkdown(url, currentPage);
|
||||
serializableOutput.markdown = [{ content: markdown }];
|
||||
}
|
||||
|
||||
// HTML conversion
|
||||
if (formats.includes('html')) {
|
||||
html = await convertPageToHTML(url);
|
||||
html = await convertPageToHTML(url, currentPage);
|
||||
serializableOutput.html = [{ content: html }];
|
||||
}
|
||||
|
||||
@@ -820,16 +830,6 @@ async function executeRun(id: string, userId: string, requestedFormats?: string[
|
||||
|
||||
plainRun.status = 'running';
|
||||
|
||||
browser = browserPool.getRemoteBrowser(plainRun.browserId);
|
||||
if (!browser) {
|
||||
throw new Error('Could not access browser');
|
||||
}
|
||||
|
||||
let currentPage = await browser.getCurrentPage();
|
||||
if (!currentPage) {
|
||||
throw new Error('Could not create a new page');
|
||||
}
|
||||
|
||||
const workflow = AddGeneratedFlags(recording.recording);
|
||||
|
||||
browser.interpreter.setRunId(plainRun.runId);
|
||||
|
||||
Reference in New Issue
Block a user