New maintainer
This is a fork of rlach's wiki-import. I will be maintaing it as I have time. Please feel free to open issues so I can address them!
FoundryVTT Wikipedia to Journal importer
Imports wikipedia articles as journal entries in Foundry VTT.
The module will try to contain all the links in original article. The links will be done to JournalEntries, by name. If you have, or will create properly named entry in the future the linking will start working.
The images will be set to float on the right side of the text, except for the images in infoboxes, which will be included in the infobox.
Infoboxes won't use templates from wikipedia, instead they will be represented as simple tables with 2 columns, placed to the right of the text.
How to use
Open journal entry you want to import wikipedia to, on top of the window you'll find Wiki
button. Click it, and you'll see dialog window with import settings.
There are two ways to import the content:
Direct wiki import
Enter the full url of the page you want to import (including https)
- If url is filled in all other fields are ignored.
https://user-images.githubusercontent.com/5655000/127136277-03fee9c7-ef03-480f-a31b-3a03d8815d16.mov
Wiki source import
Enter the page source and optionally domain name to import the page
- The domain name should NOT include https, so it should be formatted, for example
wikipedia.org
. - The domain name will be remembered between imports.
- The source should be in wikipedia syntax. To find it click "edit source" or "view source" button on the wikipedia article.
- You should use this option if importing by URL doesn't work. Usually it's caused by CORS issues.
- The domain name is needed to properly import images from target URL.
https://user-images.githubusercontent.com/5655000/127136342-0da82547-95fb-4a3d-876c-ba93b72f6531.mov
Quick Insert module support
If you have Quick Insert module installed the importer will try to link wikipedia links to your compedia during import. This is rather slow currently, but will often link deities, ancestries(or races), classes, backgrounds etc. that appear in your documents to proper compedias.
Sometimes it might link not 100% accurate, for example herbalist
can be both archetype and background in Pathfinder 2e, so it's not possible to know which you wanted to have linked. The linker will prioritize Item
entries, then JournalEntry
entries, and all others, like Actor
entries will be used last.
If you don't want to use this feature you can disable it in setting that appears only when Quick Insert is installed.
Image downloading
You can enable image downloading, but it will work pretty much only with wikis you own and have CORS properly configured for your foundry installation.
If enabled the images will be downloaded to your user data/wiki-import/wikipedia.domain/
folder. In case download fails for any reason it will be linked normally.
Limitations
This module uses wtf_wikipedia to parse the articles, so it has most of the limitations described on their repository. This means the articles won't be imported 100% accurate, but it will still be pretty close. Requiring very little(if any) manual fixes afterwards.
In addition:
Image resolution might work or not depending on how given wiki stores the data. For example fandom.org
wikis won't work. If the images is just plain link instead of File syntax it will not work.
References are not imported(those pesky numbers in square brackets that refer to original sources).