likers-blocker
likers-blocker copied to clipboard
Fix AccountCollector Selector, add build and start commands for Windows
Fixed the userCells
selector that was previously failing on gathering users.
Using a placeholder number for totalUserCount
due to the unavailability of the API.
Introduced new commands for starting and building the application on Windows platforms.
Theorically the function below should work, but couldn't get it working...
private async getTotalUsersCount(): Promise<number> {
const isRetweetsPage = await TwitterPage.isRetweetsPage();
const isTweetPage = await TwitterPage.isTweetPage();
const isListPage = await TwitterPage.isListPage();
let totalUsersCount = -1;
if (isTweetPage) {
const interactionElements = document.querySelectorAll('article div[role="group"] a span');
let tweetLikes = -1;
let tweetReposts = -1;
interactionElements.forEach(iElement => {
if (iElement.textContent === 'Likes') {
tweetLikes = parseInt(iElement.parentElement.parentElement.querySelector('[data-testid="app-text-transition-container"]').textContent);
} else if (iElement.textContent === 'Reposts') {
tweetReposts = parseInt(iElement.parentElement.parentElement.querySelector('[data-testid="app-text-transition-container"]').textContent);
}
});
totalUsersCount = isRetweetsPage ? tweetReposts : tweetLikes;
} else if (isListPage) {
const listId = await TwitterPage.getListId();
const list = await APIService.getList(listId);
totalUsersCount =
isListPage === AccountList.followers ? list.subscriber_count : list.member_count;
}
// prevent multiple api calls of not successful:
if (!totalUsersCount) {
totalUsersCount = -1;
}
return totalUsersCount;
}