Created
May 17, 2016 06:54
-
-
Save domharrington/15e6937324ce4fafc3133839475b59f7 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
const request = require('request-promise') | |
const cheerio = require('cheerio') | |
request('http://www.bbcgoodfood.com/recipes').then(html => { | |
const $ = cheerio.load(html) | |
var categories = $('a[href^="/recipes/category"]').map(function (i, category) { | |
return { href: $(this).attr('href'), label: $(this).text() } | |
}).filter((i, category) => { | |
return category.label !== 'see more ...' | |
}).toArray() | |
console.log(categories); | |
}, err => { | |
console.error(err) | |
process.exit(1) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment