Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ab9260

Browse files
committed
new file: ../_posts/2020-05-06-THBWikiMultiUploadIntro.MD
new file: about-suncl.png new file: post-bg-WBaWC.jpg modified: ../_config.yml
1 parent 3ff60fb commit 1ab9260

File tree

3 files changed

+64
-0
lines changed

3 files changed

+64
-0
lines changed
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
layout: post
3+
title: THBWikiMultiUploadIntro
4+
subtitle: THBWiki多文件上传工具介绍
5+
date: 2020-05-06
6+
author: SunCL
7+
header-img: img/post-bg-WBaWC.jpg
8+
catalog: true
9+
tags:
10+
- MediaWiki
11+
- THBWiki
12+
- Python
13+
---
14+
15+
16+
# THBWiki Multi Upload Tool
17+
[THBWikiMultiUpload](https://github.com/a774500050/THBWikiMultiUpload)
18+
A simple python tool to upload files to THBWiki
19+
Note that this tool will upload every file in the directory.
20+
## Requirements
21+
just need module [Requests](https://github.com/psf/requests)
22+
```shell script
23+
pip install requests
24+
```
25+
## Start
26+
You need to create a [BotPassword](https://thwiki.cc/Special:BotPasswords).
27+
>Bot passwords allow access to a user account via the
28+
> API without using the account's main login credentials.
29+
> The user rights available when logged in with a bot password may be restricted.
30+
31+
Since you need to upload files, you will need at least those permissions:
32+
* Basic rights (granted default 基本权限 默认已授权)
33+
* Create, edit, and move pages (创建、编辑和移动页面)
34+
* Upload new files (上传新文件)
35+
* Upload, replace, and move files (上传,替换和移动文件)
36+
37+
After creating the bot, just create a **BotToken.txt** in the **main.py** file's
38+
same directory.
39+
The **BotToken.txt** file should be encoded in UTF-8 and like this:
40+
```text
41+
botusername=XXXXX
42+
botpassword=XXXXX
43+
```
44+
Then you can run the python file.
45+
## Run
46+
Run the python file.
47+
If you set the bot correctly, you will see the terminal shows:
48+
```shell script
49+
Login Success
50+
```
51+
Then you need to input the directory path that contains files you need to upload.
52+
The program will upload **everything** in the directory.
53+
54+
After inputting the directory, you can input the upload comment for all files
55+
onetime, or you can just leave it blank. It also supports **WikiText**.
56+
For example:
57+
```text
58+
[[分类:poprication]][[分类:周边图片]]
59+
```
60+
Terminal will show the status of each file.
61+
## Uploading Example
62+
![example](https://wx1.sinaimg.cn/large/9bd2f91fgy1gefprmju36j20td07babd.jpg)
63+
## About
64+
If you have any problem, just contact [User:SunCL](https://thwiki.cc/User:SunCL).

img/about-suncl.png

758 KB
Loading

img/post-bg-WBaWC.jpg

2.94 MB
Loading

0 commit comments

Comments
 (0)