Created
August 31, 2023 10:27
-
-
Save vermi321/8944d58a54ebb8cb30bce60e701fae6a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(async () => { | |
const sleep = ms => new Promise(resolve => setTimeout(resolve, ms)); | |
const getUsernameEls = () => document.querySelectorAll('.db-table-body .db-user-name'); | |
const getRowEls = () => document.querySelectorAll('.db-table-body .db-table-row'); | |
const goToPage = async page => { | |
document.querySelector(`.db-talbe-pagination li[title="${page}"]`).click(); | |
await sleep(1000); | |
while (getUsernameEls().length === 0) { | |
await sleep(100); | |
} | |
} | |
let prevPageNumber = Math.max( | |
...Array.from( | |
document.querySelectorAll('.db-talbe-pagination .ant-pagination-item') | |
).map(e => Number(e.title)) | |
); | |
const sybils = []; | |
while (prevPageNumber) { | |
try { | |
console.log(`Navigating to the page: ${prevPageNumber}`); | |
await goToPage(prevPageNumber); | |
Array.from(getRowEls()).map(item => { | |
const isSybil = item.querySelector('.db-user-tag-list').textContent.toLowerCase().includes('sybil'); | |
const username = item.querySelector('.db-user-name').textContent; | |
if (isSybil) { | |
sybils.push(username); | |
console.log(`Sybil found: ${username}. Checking for more`); | |
} | |
}); | |
prevPageNumber -= 1; | |
} catch { | |
prevPageNumber = null; | |
} | |
} | |
console.log( | |
sybils.length | |
? `Done. Sybils found:\n${sybils.join('\n')}` | |
: 'Done. No sybils found' | |
); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment