自动向 wiki 添加条目

发布于 2024-07-05 03:48:51 字数 625 浏览 7 评论 0原文

一旦我有了重命名的文件,我需要将它们添加到我的项目的 wiki 页面。 这是一项相当重复的手动任务,所以我想我可以编写脚本,但我不知道从哪里开始。

过程是:

Got to appropriate page on the wiki

for each team member (DeveloperA, DeveloperB, DeveloperC)
{
    for each of two files ('*_current.jpg', '*_lastweek.jpg')
    {
        Select 'Attach' link on page
        Select the 'manage' link next to the file to be updated
        Click 'Browse' button
        Browse to the relevant file (which has the same name as the previous version)
        Click 'Upload file' button
    }
}

不一定要寻找完整的解决方案,因为我想自己尝试一下。

从哪里开始? 我可以使用什么语言来做到这一点以及它有多困难?

Once I have my renamed files I need to add them to my project's wiki page. This is a fairly repetitive manual task, so I guess I could script it but I don't know where to start.

The process is:

Got to appropriate page on the wiki

for each team member (DeveloperA, DeveloperB, DeveloperC)
{
    for each of two files ('*_current.jpg', '*_lastweek.jpg')
    {
        Select 'Attach' link on page
        Select the 'manage' link next to the file to be updated
        Click 'Browse' button
        Browse to the relevant file (which has the same name as the previous version)
        Click 'Upload file' button
    }
}

Not necessarily looking for the full solution as I'd like to give it a go myself.

Where to begin? What language could I use to do this and how difficult would it be?

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

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

发布评论

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

评论(3

小苏打饼 2024-07-12 03:48:52

您可能会发现 CoScripter 很有用——它是一个 Firefox 扩展,允许您自动执行任务网站。 我不确定您如何将其与您在本地系统上更改的文件列表集成,但它肯定可以处理通过网络表单上传的文件。

更好的选择可能是使用 cURL 或类似的 HTTP 库以及您选择的编程语言。 如果您使用的是 *nix,则可以在 shell 中使用 cURL 命令行程序脚本来相当轻松地完成此操作。 (就像 @jsight 所说,您需要使用 Fiddler 分析网页上使用的实际表单,或者只是查看表单元素并通过 cURL 重新创建 POST。)

You might find CoScripter useful -- it's a Firefox extension that allows you to automate tasks you perform on websites. I'm not certain how you'd integrate this with the list of files you're changing on your local system, but it can certainly handle the file uploading through a web form.

Better bet is probably using cURL or a similar HTTP library with your programming language of choice. If you're on *nix, you can use the cURL commandline program inside your shell script to get this done fairly easily. (Like @jsight said you will need to analyze the actual forms you're using on the webpage, using Fiddler or just looking at the form elements and re-creating the POST through cURL.)

短叹 2024-07-12 03:48:52

检查您要与之交谈的 wiki 是否支持 XMLRPC,因为如果支持,那么它应该是折断。 我编写了一个名为 WikiUp 的工具来解决类似的问题(更新指定的部分)在维基页面上)。

Check if the wiki you mean to talk to supports XMLRPC, because if it does it should be a snap. I wrote a tool called WikiUp to solve a similar problem (updating a delineated section on a wiki page).

无力看清 2024-07-12 03:48:52

如果您使用 C# 编写,WebClient 类可能是一个不错的起点。 我敢打赌,如果您提到您正在使用哪个维基平台,以及它是否需要身份验证,人们可以提供更具体的建议。

我可能会首先下载 fiddler 并手动观察 http 请求。 然后,您可以使用一些简单的脚本和正则表达式来构建 http 请求以自动化该过程。

当然,如果你非常幸运,你的 wiki 会有一个足够简单的后端,你可以直接将它们插入到它的数据库中。 :)

If you're writing in C#, the WebClient classes might be a good place to start. I bet people could give more specific advice if you mentioned which wiki platform you are using, and whether it requires authentication, though.

I'd probably start by downloading fiddler and watching the http requests from doing it manually. Then you could use some simple scripts and regexes to build your http requests for automating the process.

Of course, if your wildly lucky, your wiki would have a backend simple enough that you could just plug them into its db directly. :)

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