Pagination with Javascript


#1

Hi,

I’m trying to crawl this site:

https://giladiskon.com/

However, I can’t crawl thru the pagination because they are using javascript:

<a id=“ctl00_Content_rptPaging_ctl00_paging” class=“page-link” href=“javascript:__doPostBack(&#39;ctl00$Content$rptPaging$ctl00$paging&#39;,&#39;&#39;)”>1</a>

The javascript function look like this:

function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}

So how can I crawl this?

Thanks a lot


#2

Hi @seoplatinum,

I checked the website, I recommend use Apify actor with Apify SDK for that. You can use headless chrome browser in actor and you can click as a user on pagination and get results easy.

You can use this example as boilerplate for your actor.
If you are OK with local development you can use Apify CLI, where you can see live browser on your local and see how it works.