Created
November 29, 2018 06:32
-
-
Save apple502j/5c10a7198c62b6b6cb82e5b1f1444bb3 to your computer and use it in GitHub Desktop.
Botのプログラムです。Licensed under BSD-2-clause
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import re | |
import mw_api_client as mw | |
ja=mw.Wiki("https://ja.scratch-wiki.info/w/api.php","ExtLinker by Apple502j") | |
ja.login("username","password") | |
summary="Scratchリンクの内部リンク化 (Bot)" | |
l=ja.exturlusage( | |
url="scratch.mit.edu", | |
protocol="https", | |
eunamespace="0" | |
) | |
regex=re.compile(r"\[https:\/\/scratch\.mit\.edu\/([^ ]+) ([^]]+)\]") | |
for p in l: | |
p.edit(regex.sub(r"[[scratch:\1|\2]]", p.read()), summary) | |
print(f"{p.title} 完了。") | |
sleep(1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from time import sleep | |
import re | |
import mw_api_client as mw | |
ja=mw.Wiki("https://ja.scratch-wiki.info/w/api.php","ExtLinker by Apple502j") | |
ja.login("username","password") | |
summary="古いプロジェクトリンクの変更 (Bot)" | |
l=ja.category("物理チュートリアル").categorymembers( | |
namespace="0" | |
) | |
regex=re.compile(r"\[\[scratch:projects\/[\w-]+\/([0-9]+)\/?(?:|#player)\|([^]]+)\]\]") | |
for p in l: | |
p.edit(regex.sub(r"[[scratch:projects/\1/|\2]]", p.read()), summary) | |
print(f"{p.title} 完了。") | |
sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment