import re import requests S = requests.Session() URL = 'https://zh.wikivoyage.org/w/api.php' PARAMS = { 'action': 'purge', 'titles': 'Wikivoyage:互助客栈', 'format': 'json' } cnt = 0 while True: cnt += 1 # Get page title req = requests.get('https://zh.wikivoyage.org/zh-tw/Wikivoyage:互助客栈') html = req.text m = re.search(r'(.+?)', html) if m: print(cnt, m.group(1)) # Purge page R = S.post(url=URL, params=PARAMS)