URL 的输入在 Javascript 中似乎不起作用;返回问号和输入 url,然后不确定地运行

问题描述 投票:0回答:0

我正在使用来自 GitHub (https://github.com/Lorenzik/TMRB) 的脚本,测试 Tiktok 报告机器人。我完全不懂 Javascript,我是一名 Python 程序员。

我已经通过 WebStorm 运行脚本来检查语法错误并获得一些调试反馈,但到目前为止,还没有成功。

我无法弄清楚是我输入的 url 语法有误,还是出现了其他问题。经过多次尝试后,换掉逗号、括号和引号似乎没有帮助,因此转向社区寻求我似乎无法弄清楚的(可能非常明显的)答案。感谢所有帮助!

url 输入的代码片段,发生错误的地方:

rl.question(`${chalk.gray(`${new Date().toLocaleTimeString()} `) + chalk.grey(`[`) + chalk.cyan.bold(`?`) + chalk.grey(`]`)} "www.example.com/reportnumber" `  , async function (answer) {
  ascii()

完整的 javascript(包括作者的促销):

import fetch from "node-fetch"
import HttpsProxyAgent from "https-proxy-agent"
import chalk from 'chalk'
import fs from 'fs'
import gradient from 'gradient-string'
import readline from 'readline'

process.stdout.write(
  String.fromCharCode(27) + "]0;" + `TikTok Mass Report Bot | Reports: 0 | Speed: 0/m` + String.fromCharCode(7)
);

console.error = function() {}
process.on('uncaughtException' || "unhandledRejection", function (err) {
  null
});

function ascii() {
  console.clear()
  const ascii = gradient.vice(`
              ▄▄▄▄▄▪  ▄ •▄ ▄▄▄▄▄      ▄ •▄     ▄▄▄▄· ▄• ▄▌▄▄▌  ▄ •▄     ▄▄▄  ▄▄▄ . ▄▄▄·      ▄▄▄  ▄▄▄▄▄
              •██  ██ █▌▄▌▪•██  ▪     █▌▄▌▪    ▐█ ▀█▪█▪██▌██•  █▌▄▌▪    ▀▄ █·▀▄.▀·▐█ ▄█▪     ▀▄ █·•██  
              ▐█.▪▐█·▐▀▀▄· ▐█.▪ ▄█▀▄ ▐▀▀▄·    ▐█▀▀█▄█▌▐█▌██▪  ▐▀▀▄·    ▐▀▀▄ ▐▀▀▪▄ ██▀· ▄█▀▄ ▐▀▀▄  ▐█.▪
              ▐█▌·▐█▌▐█.█▌ ▐█▌·▐█▌.▐▌▐█.█▌    ██▄▪▐█▐█▄█▌▐█▌▐▌▐█.█▌    ▐█•█▌▐█▄▄▌▐█▪·•▐█▌.▐▌▐█•█▌ ▐█▌·
              ▀▀▀ ▀▀▀·▀  ▀ ▀▀▀  ▀█▄▀▪·▀  ▀    ·▀▀▀▀  ▀▀▀ .▀▀▀ ·▀  ▀    .▀  ▀ ▀▀▀ .▀    ▀█▄▀▪.▀  ▀ ▀▀▀                                                        
  `)
  console.log(ascii)
  console.log(chalk.grey('----------------------------------------------------------------------------------------------------------------------'))
  console.log(chalk.white('    https://github.com/Lorenzik/TMRB'),chalk.grey(" | "),chalk.white('https://github.com/Lorenzik/TMRB'),chalk.grey(" | "),chalk.white('https://github.com/Lorenzik/TMRB'),)
  console.log(chalk.grey('----------------------------------------------------------------------------------------------------------------------\n'))
}

ascii()

const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});

rl.question(`${chalk.gray(`${new Date().toLocaleTimeString()} `) + chalk.grey(`[`) + chalk.cyan.bold(`?`) + chalk.grey(`]`)} "www.example.com/reportnumber" `, async function (answer) {
  ascii()

  var reportCount = 1, reportsPerSecond = 0
  var text = fs.readFileSync('proxies.txt','utf8')
  var proxies = text.split(/\r?\n/)

setInterval(() => {
  proxies.forEach(async proxy => {
    const proxyAgent = new HttpsProxyAgent(`http://${proxy}`);
    const url = await fetch(answer, { agent: proxyAgent});
    const json = await url.json();
    console.log(chalk.gray(`           ${new Date().toLocaleTimeString()}  `) + gradient.vice(` Send report with ID: ${json.extra.logid} | Report count: ${reportCount}`))
    reportCount++,reportsPerSecond++
})
}, 300);
  setInterval(() => {
    process.stdout.write(
      String.fromCharCode(27) + "]0;" + `TikTok Mass Report Bot | Reports: ${reportCount} | Speed: ${reportsPerSecond*6}/m` + String.fromCharCode(7)
    );
    reportsPerSecond = 0
  }, 10000);
})

依赖项(json格式)可以在这里找到:https://github.com/Lorenzik/TMRB/blob/main/package.json

使用的代理(txt 文件)可以在这里找到: https://github.com/Lorenzik/TMRB/blob/main/proxies.txt

javascript bots webstorm
© www.soinside.com 2019 - 2024. All rights reserved.