Skip to content

Instantly share code, notes, and snippets.

@dijs
Created November 16, 2015 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dijs/a29c6aa70d12b4768648 to your computer and use it in GitHub Desktop.
Save dijs/a29c6aa70d12b4768648 to your computer and use it in GitHub Desktop.
Spying on James Bond
import 'babel-polyfill'
import Wiki from './dist/wiki'
import Knwl from 'knwl.js'
let knwlInstance = new Knwl('english')
knwlInstance.register('dates', require('./node_modules/knwl.js/default_plugins/places'));
let wiki = new Wiki({
uri: 'http://jamesbond.wikia.com/api.php'
})
async function findBondPlaces() {
let films = await wiki.search('James_Bond_films')
let pages = await Promise.all(films.results.map(film => wiki.page(film)))
let descriptions = await Promise.all(pages.map(page => page.content()))
let text = descriptions.join(' ')
knwlInstance.init(text)
let places = knwlInstance.get('places')
}
findBondPlaces()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment