Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
proxyUrl = config.config.proxyUrl;
}
let windowHeight;
if (config.config && config.config.windowHeight) {
windowHeight = config.config.windowHeight;
}
let windowWidth;
if (config.config && config.config.windowWidth) {
windowWidth = config.config.windowWidth;
}
let userAgent = "";
if (!config.config || (config.config && (!config.config.userAgent || config.config.userAgent === "random"))) {
userAgent = new UserAgent();
}
if (config.config && config.config.userAgent === "desktop") {
userAgent = new UserAgent({deviceCategory: "desktop"});
}
if (config.config && config.config.userAgent === "mobile") {
userAgent = new UserAgent({deviceCategory: "mobile"});
}
let protocolPort = 9730;
if (config.config && config.config.protocolPort) {
protocolPort = config.config.protocolPort;
}
let bridgePort = 9731;
if (config.config && config.config.bridgePort) {
bridgePort = config.config.bridgePort;
}
//spawn the chrome instance
const headlessChrome = getInstance();
await headlessChrome.init({
headless: headless,
const userAgents = new Set();
let data = null;
for (const query of browsers) {
const options = {
browsers: [query],
allowHigherVersions: true
};
const versions = getBrowsersList(options);
for (let i = 0; i < 30; i++) {
try {
data = new UserAgent(({ userAgent }) =>
!userAgents.has(userAgent)
&& mobile(userAgent, i)
&& matchesUA(userAgent, options)
);
} catch (err) {
continue;
}
userAgents.add(data.userAgent);
yield {
versions: versions.map(_ => `${_.family} ${_.version.join('.')}`),
userAgent: data.userAgent,
query
};
}
}
return (new UserAgent({
deviceCategory: "mobile",
platform: platform || "Linux armv8l"
})).data;
}
if (agent === "chrome-desktop") {
return (new UserAgent([
/Chrome/,
{
deviceCategory: "desktop",
platform: platform || "Win32"
}
])).data;
}
if (agent === "chrome-mobile") {
return (new UserAgent([
/Chrome/,
{
deviceCategory: "mobile",
platform: platform || "Linux armv8l"
}
])).data;
}
//default to chrome-desktop
return (new UserAgent([
/Chrome/,
{
deviceCategory: "desktop",
platform: platform || "Win32"
}
])).data;
platform: EmulatorOptions["platform"] | undefined
): UserAgentDataType {
try {
if (agent === "random") {
return (new UserAgent({
platform: platform || "Win32"
})).data;
}
if (agent === "desktop") {
return (new UserAgent({
deviceCategory: "desktop",
platform: platform || "Win32"
})).data;
}
if (agent === "mobile") {
return (new UserAgent({
deviceCategory: "mobile",
platform: platform || "Linux armv8l"
})).data;
}
if (agent === "chrome-desktop") {
return (new UserAgent([
/Chrome/,
{
deviceCategory: "desktop",
platform: platform || "Win32"
}
])).data;
}
if (agent === "chrome-mobile") {
return (new UserAgent([
/Chrome/,
}
let proxyUrl;
if (config.config && config.config.proxyUrl) {
proxyUrl = config.config.proxyUrl;
}
let windowHeight;
if (config.config && config.config.windowHeight) {
windowHeight = config.config.windowHeight;
}
let windowWidth;
if (config.config && config.config.windowWidth) {
windowWidth = config.config.windowWidth;
}
let userAgent = "";
if (!config.config || (config.config && (!config.config.userAgent || config.config.userAgent === "random"))) {
userAgent = new UserAgent();
}
if (config.config && config.config.userAgent === "desktop") {
userAgent = new UserAgent({deviceCategory: "desktop"});
}
if (config.config && config.config.userAgent === "mobile") {
userAgent = new UserAgent({deviceCategory: "mobile"});
}
let protocolPort = 9730;
if (config.config && config.config.protocolPort) {
protocolPort = config.config.protocolPort;
}
let bridgePort = 9731;
if (config.config && config.config.bridgePort) {
bridgePort = config.config.bridgePort;
}
//spawn the chrome instance
var teamName = teamHtml.match(/<a href="\'.+?\'">(.+?)<\/a><\/td>/i)[1],
points = teamHtml.match(/(\d+)<\/td>/i)[1];
table.push({ name: teamName, points: parseInt(points) });
});
return table;
}
var options = {
url: 'http://www.bbc.co.uk/sport/football/tables',
headers: {
'User-Agent': agents.random()
}
};
request(options, function response(error, response, body) {
if (!error && response.statusCode == 200) {
table = eplTable(body);
}
});
app.get('/english-premier-league.json', function(request, response) {
response.send(JSON.stringify(table));
});
})(process);</a>