Add user-agent to the request headers to be less shady
This commit is contained in:
parent
a5f724faed
commit
05d90e6068
2 changed files with 11 additions and 2 deletions
|
@ -7,6 +7,12 @@ var options = require('./options.js');
|
|||
|
||||
var cache = {}
|
||||
|
||||
var request_options = {
|
||||
'headers': {
|
||||
'user-agent': options.userAgentString
|
||||
}
|
||||
}
|
||||
|
||||
// Note: http://site.com/image/icons/home.png -> http://site.com/image/icons
|
||||
function absoluteURLPath (aURL) {
|
||||
var URL = url.parse(aURL)
|
||||
|
@ -49,7 +55,7 @@ function retrieveFile (aAbsBasePath, aFilePath, aBinary) {
|
|||
return cache[cacheKey]
|
||||
} else {
|
||||
try {
|
||||
var res = request('GET', fullFilePath)
|
||||
var res = request('GET', fullFilePath, request_options)
|
||||
|
||||
if (!options.suppressVerboseOutput)
|
||||
console.warn('Retrieving file', fullFilePath, '...')
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
'use strict'
|
||||
|
||||
var options = {
|
||||
outputFinalResultAsBase64: false,
|
||||
suppressVerboseOutput: false
|
||||
suppressVerboseOutput: false,
|
||||
userAgentString: 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.76 Safari/537.36',
|
||||
}
|
||||
|
||||
module.exports = options
|
||||
|
|
Loading…
Reference in a new issue