Untitled

mail@pastecode.io avatar
unknown
javascript
3 years ago
1.9 kB
3
Indexable
Never
const fetch = require('node-fetch');
const cheerio = require('cheerio');
const cheerioTableparser = require('cheerio-tableparser');
const fs = require("fs");
const delay = require("delay")


const sunyouRequest = (wallet) => new Promise((resolve, reject) => {
    fetch(`https://viewblock.io/zilliqa/address/${wallet}?txsType=tokens`, {
        method:'GET'
    })
    .then(res => res.text())
    .then(res => {
        const $ = cheerio.load(res);
        cheerioTableparser($);
        const data = $('table.m2xij9-3.sZDrq').parsetable(true, true, true);
        resolve(data)
    })
    .catch(err => reject(err))
    
});


const genUniqueId = length =>
    new Promise((resolve, reject) => {
        var text = "";
        var possible =
            "1234567890";

        for (var i = 0; i < length; i++)
            text += possible.charAt(Math.floor(Math.random() * possible.length));

        resolve(text);
    });

;(async() => {
    fs.readFile('list.txt', async function(err, data) {
        if (err) throw err;
        const array = data
          .toString()
          .replace(/\r\n|\r|\n/g, " ")
          .split(" ");

        for (let index = 0; index < array.length; index++) {
            const element = array[index];
            const sunyouRequestREsult = await sunyouRequest(element);
            sunyouRequestREsult[3].splice(0, 1)
            const newFilter = sunyouRequestREsult[3].filter(x => x.includes('PORT Scan Contract'));
            console.log(element, " => ", sunyouRequestREsult[6][1] ? `Landing bos | ${newFilter.length} PORT` : 'sedih ga landing')
            if(sunyouRequestREsult[6][1] == "1 PORT"){
                await fs.appendFileSync('landink.txt', `${element} = ${newFilter.length} PORT\n`);
            }
            await delay(15000);
        }
  
        
      });
    
    
    

})();