diff --git a/functions.js b/functions.js index 9141870..292817f 100644 --- a/functions.js +++ b/functions.js @@ -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, '...') diff --git a/options.js b/options.js index a10c9da..22ec299 100644 --- a/options.js +++ b/options.js @@ -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