Add user-agent to the request headers to be less shady

pull/7/head
vflyson 7 years ago
parent a5f724faed
commit 05d90e6068

@ -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…
Cancel
Save