我正在尝试向站点发送获取请求。这完美无缺,但现在我想在请求 URL 之后添加一个随机字符串。但不幸的是,这似乎不起作用。我认为这是因为选项参数不能访问除 idk 之外的任何其他内容,如果有人能调查一下并帮助我,我将不胜感激。
....
const chalk = require("chalk")
require('console-stamp')(console, {
format: ':date(yyyy/mm/dd HH:MM:ss.l)'
} );
var randomstring = require("randomstring");
let rndmstring = randomstring.generate({
length: 12,
charset: 'alphabetic'
});
const options = {
url: 'https://www.requesturl?search=housenumbers&'+ rndmstring,
method: "GET",
gzip: true,
proxy: reformatProxy(proxies2[randomproxy]),
headers: {
"method": "GET",
"scheme": "https",
"accept": "*/*",
"accept-encoding": "gzip, deflate, br",
"accept-language": "de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7",
"cookie": "_ga=GA1.2.984479855.1612702925; _gid=GA1.2.658293268.1613141568; _gat_UA-168024539-1=1",
"user-agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.150 Safari/537.36",
"sec-fetch-dest": "empty",
"sec-fetch-mode": "cors",
"Cache-Control": "no-cache",
"sec-fetch-site": "same-origin",
"x-requested-with": "XMLHttpRequest"
}
};
...
setInterval(() => {
request(options, callback)
}, delay)