Skip to content

Instantly share code, notes, and snippets.

@WingofaGriffin
Last active March 5, 2020 00:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save WingofaGriffin/83f1df1987a5ec39f5a5b38c5d5ce1d0 to your computer and use it in GitHub Desktop.
Save WingofaGriffin/83f1df1987a5ec39f5a5b38c5d5ce1d0 to your computer and use it in GitHub Desktop.
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("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