MediaWiki 1.16.4:上传多个图像文件的脚本

发布于 2024-11-29 23:46:04 字数 203 浏览 2 评论 0原文

我正在使用 MediaWiki 1.16.4,目前必须从使用 HTML 的帮助网站迁移到使用 mediawiki 的新帮助网站。我遇到的一个问题是在不使用网络界面的情况下将大量图像上传到 mediawiki(因为这将花费很长时间)。我目前正在尝试使用 pywikipedia (这是一个 python 机器人)来完成任务,但尚未成功。你们中有人碰巧知道该任务的脚本吗?

谢谢,

I am using MediaWiki 1.16.4 and currently have to migrate from a help site using HTML to a new help site with mediawiki. One problem I bump into is to upload a mass amount of images onto mediawiki without using the web interface (since that would take forever and a half). I am currently trying to use pywikipedia (which is a python bot) for the task but haven't succeeded yet. Does any of you happen to know a script for the task?

Thansk,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

全部不再 2024-12-06 23:46:04

请参阅此处的“公然黑客”部分:http://meta.wikimedia.org/wiki/MediaWiki_Bulk_Page_Creator 一个可以做到这一点的 PHP 脚本。

与许多机器人脚本一样,您需要可用的 PHP Snoopy 库。该脚本相当旧,并且不使用 API,因此我不确定它是否适用于新的 CSRF 保护。如果有更新的,我还没有找到。

重写它以使用 API 可能是个好主意,这并不难。如果你想这样做,我在这里有一个如何使用 PHP 和 cURL 来通过 API 登录的演示: http://www.mediawiki.org/wiki/User:Bcoughlan/Login_with_curl

See the section "Blatant hack" here: http://meta.wikimedia.org/wiki/MediaWiki_Bulk_Page_Creator for a PHP script that does just that.

As with many of those bot scripts, you'll need the PHP Snoopy library available. This script is pretty old and doesn't use the API, so I'm not sure if it will work with the new CSRF protection. If a newer one exists, I haven't found it.

It might be a good idea to rewrite it to use the API, it's not that hard. If you want to do that I have a demo of how to use PHP with cURL to login with the API here: http://www.mediawiki.org/wiki/User:Bcoughlan/Login_with_curl

两个我 2024-12-06 23:46:04

尝试从 upload.py sourceforge.net/" rel="nofollow">pywikipedia 机器人框架。

一抹苦笑 2024-12-06 23:46:04

我对现有工具为这个简单的事情提供大量代码感到非常恼火。所以我建立了自己的。包括 python 中的海量图像文件上传器(和下载器)。

你可能需要做一些Python hacking,因为它可能还没有被完善;但它展示了如何通过几行代码来完成它。

代码在这里:
https://github.com/gandrewstone/mediawiki_python_bot

I got so irritated with how the existing tools have massive amounts of code for this simple thing. So I built my own. Including a mass image file uploader (and downloader) in python.

You may need to do a little python hacking because it may not be polished; but it shows how it can be done in just a few lines of code.

The code is here:
https://github.com/gandrewstone/mediawiki_python_bot

无声静候 2024-12-06 23:46:04

所以我找到了答案。事实证明,MW 1.16.4 提供了自己的批量媒体上传脚本,可以在这里找到:http://www.mediawiki.org/wiki/Manual:ImportImages.php

So I have found the answer. It turns out that MW 1.16.4 provides its own script for bulk media upload which can be found here: http://www.mediawiki.org/wiki/Manual:ImportImages.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文