Created
September 25, 2015 18:53
-
-
Save gajus/aa14a954ae6a7d518ffc 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
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