Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A apify task meant to scrape https://www.nighttours.com/gaypride/ for the event data
async function pageFunction(context) {
const { request, log, jQuery } = context;
var $ = context.jQuery;
var result = [];
$.fn.ignore = function(sel){
return this.clone().find(sel||">*").remove().end();
};
$("ul li").each( function() {
if ($(this).find("span.cel-city-event").text() != ''){
result.push({
title : $(this).find("a > span.cel-city-event").ignore("span").text(),
location : $(this).find("span.cel-city").text().trim(),
date : $(this).find("span.cel-date").text().replace("*", "*Unconfirmed"),
url : $(this).find("a.list-lines").attr('href')
});
}
});
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.