如何将网址添加到puppeteer中的Flash白名单中 [英] how to add urls to Flash white list in puppeteer

查看:184
本文介绍了如何将网址添加到puppeteer中的Flash白名单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Node.js中使用puppeteer开发了小型爬虫。
目标站点具有Flash内容,因此我想在puppeteer中启用Flash。

I develop small crawler with puppeteer in Node.js. the target site has Flash contents, so I want to enable Flash in puppeteer.

默认情况下,puppeteer无法使用Flash和允许的站点白名单是空的。
我知道如何在puppeteer中启用Flash,但我不知道如何设置白名单。

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}'
        ]
    });

或者,这是在浏览器设置页面中简单地操作DOM的唯一方法(例如chrome:/ / settings / content / flash)?

Or, is it only way to simply manipulate DOM in setting page in browser (ex.chrome://settings/content/flash)?

推荐答案

我自己已经解决了这个问题。
我找不到Flash白名单的标志,无法操纵chrome设置页面的DOM对我来说太累了,但我得到了一些有用的参数。

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}’

首先,手动启动chrome或Chrome,然后将url添加到列表中。
然后,将PROFILE_FILE设置为其用户数据路径。

First, manually launch chrome or chromium, and add url to the list. Then, set PROFILE_FILE as its user data path.

2。可执行文件路径: {PATH_TO_CHROME}

基本上,在chrome上运行,但不能在Chrome上运行,默认情况下我们可以使用Flash和HLS等。
手动设置白名单,它可以工作。

Basically, run on chrome but not chromium, we can use Flash and HLS and etc. by default. Set manually white list, and it works.

这篇关于如何将网址添加到puppeteer中的Flash白名单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆