# Use Wikipedia Onebox for other MediaWiki sites

**URL:** <https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804>\
**Category:** Feature\
**Created:** [2016年三月9日 12:15 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804 "2016-03-09T12:15:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Freso](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/freso/32/49081_2.png) [@Freso](https://meta.discourse.org/u/Freso)\
**Post date:** [2016年三月9日 12:15 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/1 "2016-03-09T12:15:58Z")

</div>

Currently wikipedia.(com|org) is [hardcoded in wikipedia\_onebox.rb](https://github.com/discourse/onebox/blob/master/lib/onebox/engine/wikipedia_onebox.rb#L8), but there are plenty of other MediaWiki driven sites for which this onebox would (or should!) work just the same.

It would be neat if it could be made possible to list other sites/URLs to get parsed by this onebox.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2016年三月9日 12:45 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/2 "2016-03-09T12:45:57Z")

</div>

admin/settings search for “onebox”. There is a domain whitelist. You can add “com” (or maybe it’s .com I’ve not bothered to figure out which and just put both) if you want to whitelist everything. I’m not quite sure why this level of paranoia is necessary, so I eventually added com, edu, and so on.

---

<div class="post-metadata">

**Author:** ![Freso](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/freso/32/49081_2.png) [@Freso](https://meta.discourse.org/u/Freso)\
**Post date:** [2016年三月9日 13:20 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/3 "2016-03-09T13:20:04Z")

</div>

That doesn’t trigger the wikipedia\_onebox.rb onebox script though, which has neat stuff like showing [the specific referenced section](https://meta.discourse.org/t/support-wikipedia-anchors-in-onebox/19664) (also, apparently not all MediaWiki sites return proper “onebox” data, e.g., [http://iframely.com/debug?uri=https%3A%2F%2Fwiki.musicbrainz.org%2FDevelopment%2FSummer\_of\_Code](http://iframely.com/debug?uri=https%3A%2F%2Fwiki.musicbrainz.org%2FDevelopment%2FSummer_of_Code) )

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2016年三月9日 13:37 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/4 "2016-03-09T13:37:59Z")

</div>

Oh. (I should have been clued in to that by your referencing the source.)

And wow. I hadn’t realized how many of those oneboxes were hand-coded for each site. I’d been crediting those sites with making that happen.

---

<div class="post-metadata">

**Author:** ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)\
**Post date:** [2016年三月10日 00:45 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/5 "2016-03-10T00:45:41Z")

</div>

> [@pfaffman](#):
>
> I’m not quite sure why this level of paranoia is necessary

It becomes very easy to DDoS your site by writing a post with a hundred oneboxes, etc. And most sites on the web don’t support opengraph or oembed, so it’d be a wasted HTTP request for every URL.

---

<div class="post-metadata">

**Author:** ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)\
**Post date:** [2016年三月10日 02:28 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/6 "2016-03-10T02:28:49Z")

</div>

Aha. Well, now I see. That’s helpful.

I suppose if I had thousands (or even hundreds) of messages per day rather than dozens, and I wasn’t having people post oneboxes of their Wordpress sites I might go ahead and be properly paranoid sooner rather than later.

Thanks

---

<div class="post-metadata">

**Author:** ![Paracelsus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/paracelsus/32/164912_2.png) [@Paracelsus](https://meta.discourse.org/u/Paracelsus)\
**Post date:** [2020年七月19日 09:46 UTC](https://meta.discourse.org/t/use-wikipedia-onebox-for-other-mediawiki-sites/40804/7 "2020-07-19T09:46:55Z")

</div>

同一主题…

…我们安装了一个 MediaWiki（我们拥有该网站），并希望在我们的 Discourse 论坛上仅针对该特定 Wiki 启用 Onebox。是否可能修改现有的 [Wikipedia Onebox 脚本](https://github.com/discourse/onebox/blob/master/lib/onebox/engine/wikipedia_onebox.rb#L8) 并将其适配到我们的 Wiki？
