Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue and solution: the number of items in each page are sometimes not correct #5

Open
WalterJX opened this issue Aug 8, 2023 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@WalterJX
Copy link

WalterJX commented Aug 8, 2023

Issue:
When the number of search result are huge, e.g. 500 results, usually each page (except the last page) will contain 25 items. However sometimes the scraper found out less than 25 items.

Root cause:
This issue is caused by the "scroll down" operation at each page did not go to the very bottom of that page.
This is because the HTML changes dynamically and load more items when you scroll down. In the code "endScrollTop " is calculated in the first place, the value is no longer valid when you scroll down.
This is the line of code which I talked about:
const endScrollTop = element.scrollHeight - element.clientHeight;
(content/linkedin-scraper.js, line 18)

Suggest Solution:
Move the above line of code into the start of the scrollStep(timestamp) function. So that the "endScrollTop" will be calculated every time in a scroll down operation.
You might also want to increase the time out and duration when calling the simulateRealScrollToEnd() method.

(Forgive me by giving word suggestions instead of code, I created a fork and added some of my own features, and because I am not good at javascript, my code looks pretty mess)

@WalterJX WalterJX changed the title Issue and solution: the number of items in each page are not correct Issue and solution: the number of items in each page are sometimes not correct Aug 8, 2023
@akramaznakour
Copy link
Owner

Hi @WalterJX Thank you for reporting this issue and providing your insights, I will check out your fork for inspiration and fix this issue as soon as I find the time

@akramaznakour akramaznakour pinned this issue Aug 9, 2023
@SamMrach
Copy link
Contributor

@akramaznakour please assign me this, i can fix it.

@akramaznakour
Copy link
Owner

Hi @SamMrach Thanks a lot for the help, I assigned you the issue

@akramaznakour akramaznakour added the bug Something isn't working label Aug 13, 2023
@akramaznakour akramaznakour unpinned this issue May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants