Skip to content

Instantly share code, notes, and snippets.

@gajus
Created September 25, 2015 18:53
Show Gist options
  • Save gajus/aa14a954ae6a7d518ffc to your computer and use it in GitHub Desktop.
Save gajus/aa14a954ae6a7d518ffc to your computer and use it in GitHub Desktop.
return request('http://www.everymancinema.com/venues/')
.then(function (response) {
let $ = response.data,
locations = [];
$('.main .content a[href^="/venues/"]').each(function () {
locations.push({
nid: layman.match($(this).attr('href'), /venues\/([^\/]+)\//),
name: $(this).find('img').attr('alt'),
url: 'http://www.everymancinema.com' + $(this).attr('href')
});
});
locations = locations.slice(0, 1);
return locations;
})
.map((location) => {
return request('http://www.everymancinema.com/venues/' + location.nid + '/whats-on/');
}, {
concurrency: 5
})
.filter((response) => {
return response.incomingMessage.statusCode === 200;
})
.map((response) => {
// Is these a reasonable way to have "location" and "response" here without nesting promises?
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment