forked from tanner/qotnews
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
426 B
18 lines
426 B
const { googleBot } = require('./constants'); |
|
const { matchUrlDomain, useGoogleBotSites } = require("./sites"); |
|
|
|
module.exports.getUserAgent = (url) => { |
|
const useGoogleBot = useGoogleBotSites.some(function (item) { |
|
return typeof item === "string" && matchUrlDomain(item, url); |
|
}); |
|
|
|
if (!useGoogleBot) { |
|
return {}; |
|
} |
|
return { |
|
userAgent: googleBot.userAgent, |
|
headers: { |
|
"X-Forwarded-For": googleBot.ip |
|
} |
|
} |
|
}; |