I develop small crawler with puppeteer in Node.js.
the target site has Flash contents, so I want to enable Flash in puppeteer.
by default, puppeteer is unable to use Flash and white list of permitted sites is empty.
I know how to enable Flash in puppeteer, but I don't know how to set white list.
How to do that?
Is there flag like this?
const browser = await puppeteer.launch({
headless: false,
args: [
'--ppapi-flash-path = {FLASH_PATH}',
'--white-url = {TARGET_URL}'
]
});
Or, is it only way to simply manipulate DOM in setting page in browser (ex.chrome://settings/content/flash)?
I've solved the problem myself.
I can't find the flag of Flash white list and manipulate DOM of chrome's setting page is too tiring for me, but I got useful some params.
1. 'userDataDir: {PROFILE_FILE}'
First, manually launch chrome or chromium, and add url to the list.
Then, set PROFILE_FILE as its user data path.
2. executablePath: '{PATH_TO_CHROME}'
Basically, run on chrome but not chromium, we can use Flash and HLS and etc. by default.
Set manually white list, and it works.
After much tinkering I found a Preferences file configuration that whitelists all flash content by default.
I've made a small puppeteer wrapper to make using this very easy: puppeteer.setExtra({allowFlash: true})
{
"profile": {
"content_settings": {
"exceptions": {
"flash_data": {
"*,*": {
"setting": {
"flashPreviouslyChanged": true
}
}
},
"permission_autoblocking_data": {
"*,*": {
"setting": {
"Flash": {
"dismiss_count": 1
}
}
}
},
"plugins": {
"*,*": {
"per_resource": {
"adobe-flash-player": 1
}
}
}
},
"pref_version": 1
}
}
}