Skip to content

Fix AccountCollector Selector, add build and start commands for Windows#195

Open
maozdemir wants to merge 2 commits into
dmstern:developfrom
maozdemir:develop
Open

Fix AccountCollector Selector, add build and start commands for Windows#195
maozdemir wants to merge 2 commits into
dmstern:developfrom
maozdemir:develop

Conversation

@maozdemir

@maozdemir maozdemir commented Aug 14, 2023

Copy link
Copy Markdown

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.

@maozdemir

maozdemir commented Aug 14, 2023

Copy link
Copy Markdown
Author

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;
	}

@pkreissel
pkreissel requested a review from dmstern September 20, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant