Merged
Conversation
Member
Author
|
Todo:
|
Member
Author
|
Example code: import { launchOptions } from 'camoufox-js';
import { PlaywrightCrawler } from 'crawlee';
import { firefox } from 'playwright';
const startUrls = ['https://crawlee.dev'];
const crawler = new PlaywrightCrawler({
requestHandler: async ({ page, enqueueLinks }) => {
await page.click('h2');
await page.click('h3');
await enqueueLinks();
},
maxConcurrency: 1,
launchContext: {
launcher: firefox,
launchOptions: await launchOptions({
headless: false,
block_images: true,
fonts: ['Times New Roman'],
custom_fonts_only: true,
humanize: true,
}),
},
});
await crawler.run(startUrls);Execution: Peek.2025-02-14.16-35.mp4As set, the browser loads no images, uses only one system-installed font (aside from the ones loaded from the page directly) and uses the humanizing script to move the cursor. |
B4nan
approved these changes
Feb 24, 2025
B4nan
pushed a commit
to apify/actor-templates
that referenced
this pull request
Feb 27, 2025
Following the apify/apify-sdk-js#364 and apify/crawlee#2842 , this PR adds Camoufox-enabled templates to Apify Actor templates. The implementation is heavily based on the existing Playwright + Chrome templates. The only issue (I'm aware of) currently is the immense size of those images (as they contain Chrome and we add Camoufox binaries). Installing Camoufox directly to a `node-debian` image results in missing system dependencies. While it might be possible to install those manually in the Dockerfile, it might make the Dockerfile too complex for a regular user. 
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a Camoufox-based crawler template (
camoufox-ts).Compared to the basic
playwright-tstemplate,camoufox-tsuses thecamoufox-jspackage, which finds the correct latest Camoufox binary in GitHub Releases assets, downloads it and passes the correct launch options to it.The
main.tsscript is modified to run the downloaded binary with the correctlaunchOptions.Related to #2836