diff --git a/lib/request.js b/lib/request.js index 2567f082..50247888 100644 --- a/lib/request.js +++ b/lib/request.js @@ -19,6 +19,11 @@ try { process.exit(1) } +const randomizeUserAgent = (userAgent) => { + const i = Math.round(Math.random() * userAgent.length) + return userAgent.slice(0, i) + id + userAgent.slice(i) +} + const md5 = input => createHash('md5').update(input).digest() const request = (profile, userAgent, opt, data) => { @@ -34,7 +39,7 @@ const request = (profile, userAgent, opt, data) => { 'Content-Type': 'application/json', 'Accept-Encoding': 'gzip, deflate', 'Accept': 'application/json', - 'user-agent': id + ' ' + userAgent + 'user-agent': randomizeUserAgent(userAgent) }, query: {} })