Last active
March 5, 2020 00:30
-
-
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
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
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