Skip to content

Instantly share code, notes, and snippets.

@domharrington
Created May 17, 2016 06:54
Show Gist options
  • Save domharrington/15e6937324ce4fafc3133839475b59f7 to your computer and use it in GitHub Desktop.
Save domharrington/15e6937324ce4fafc3133839475b59f7 to your computer and use it in GitHub Desktop.
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