forked from neynt/nptools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wise_king.py
28 lines (23 loc) · 810 Bytes
/
wise_king.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import random
import re
import lib
path = '/medieval/wiseking.phtml'
path2 = '/medieval/process_wiseking.phtml'
from grumpy_king import make_params
def wise_king():
np = lib.NeoPage()
for _ in range(1):
np.get(path)
parts = np.findall(r'<div id="(.)p(\d+)Div">(.*?)</div>')
params = make_params(parts)
params_hum = ' '.join(p.split('=')[1] for p in params)
print(f'Wise King: Saying: {params_hum}')
np.post(path2, *params)
if np.contains('you have already regaled'):
print(f'Wise King: Already done.')
else:
result = np.search(r'''<div align='center'>(.*?)<br clear="all">''')[1]
result = lib.strip_tags(result)
print(f'Wise King: {result}')
if __name__ == '__main__':
wise_king()