Last active
January 31, 2018 00:05
-
-
Save jakubbalada/055810df04f813c2e2f46948521e534b to your computer and use it in GitHub Desktop.
This file contains 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
function pageFunction(context) { | |
// called on every page the crawler visits, use it to extract data from it | |
var $ = context.jQuery; | |
if (context.request.label === 'detail') { | |
context.skipLinks(); | |
// return data from internal JS variable | |
return property; | |
} else { | |
context.skipOutput(); | |
// enqueue next pages in pagination | |
$('a.search-list__pagination-link').each(function(){ | |
var url = "https://www.booli.se" + $(this).attr('href'); | |
context.enqueuePage(url); | |
}); | |
// enqueue all properties from current page | |
$('.search-list:not(.search-list--projects) .search-list__item').each(function(){ | |
var url = "https://www.booli.se" + $(this).find('a').attr('href'); | |
context.enqueuePage(url); | |
}); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment