1.0.0 • Published 2 years ago

wtf-plugin-disambig v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

a plugin for parsing disambiguation pages in wikipedia.

const wtf = require('wtf_wikipedia')
wtf.extend(require('wtf-plugin-disambig'))

wtf.fetch('Raptor').then((doc) => {
  let res = doc.disambig()
  /*
{
  text: 'Raptor',
  main: null,
  pages: [
    {
      link: 'Raptor (bird)',
      desc: 'or bird of prey, a bird that primarily hunts and feeds on vertebrates',
      section: 'Animals'
    },
    {
      link: 'Raptor (film)',
      desc: 'a 2001 film',
      section: 'Film and television'
    },
  ...
  ]
}
*/
<script src="https://unpkg.com/wtf_wikipedia"></script>
<script src="https://unpkg.com/wtf-plugin-disambig"></script>
<script defer>
  wtf.plugin(window.wtfDisambig)
  wtf.fetch('spencer').then((doc) => {
    let res = doc.disambig()
    console.log(res)
  })
  /*{
    text: 'Spencer',
    main: null,
    pages: [
      { link: 'Spencer, Missouri', desc: '', section: 'United States' },
      { link: 'Spencer (film)',  desc: 'a 2021 drama film about Princess Diana',  section: 'Other uses'   }
    ]
  }*/
</script>

MIT

1.0.0

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago

0.0.1

3 years ago