wtf_wikipedia icon indicating copy to clipboard operation
wtf_wikipedia copied to clipboard

support images in tables

Open qxb3 opened this issue 2 years ago • 3 comments

So i have this wiki for a game Link

And they have this table with some images and looks like images() function is not catching those images?

Here my code:

const page = await wiki.fetch(title, {
  domain: 'www.miragerealms.co.uk',
  path: 'wiki/api.php'
})

const test = page.images().map(image => image.url())
console.log(test)

qxb3 avatar Jul 29 '22 00:07 qxb3

hey @qxb3 - good catch. it's not looking for images inside tables.

let str = `
{|
|-
| [[File:Sword-0.png]]
| [[Primitive Sword]]
| 4
| 15
|}
`
let doc = wtf(str)
console.log(doc.images())

i'm happy to add this in the next release. Can try to do it next week. cheers

spencermountain avatar Jul 29 '22 16:07 spencermountain

Alright. Thanks!

qxb3 avatar Jul 29 '22 16:07 qxb3

hey qxb3, this one is harder than i thought and will require a refactor. pushing it to next major release. thanks.

spencermountain avatar Dec 08 '22 01:12 spencermountain