Skip to content
This repository was archived by the owner on Mar 11, 2022. It is now read-only.

Commit c3e759a

Browse files
small changes
1 parent 6e2af8e commit c3e759a

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Help_functions/bot_functions.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from datetime import datetime
55
from random import choice, randint
66

7+
from Time_saver.utils import fight395791_
78
from login import get_content, get_nick_and_pw
89

910

@@ -169,8 +170,8 @@ def convert_to_dict(s):
169170
s_list = s.replace("'", '').split("&")
170171
s_list[0] = f"ip={s_list[0]}"
171172
return dict([a.split("=") for a in s_list])
172-
173-
173+
174+
174175
async def fighting(server, battle_id, side, wep):
175176
URL = f"https://{server}.e-sim.org/"
176177

@@ -191,9 +192,11 @@ async def fighting(server, battle_id, side, wep):
191192

192193
async def send_fight_request(URL, tree, wep, side, value="Berserk"):
193194
hidden_id = tree.xpath("//*[@id='battleRoundId']")[0].value
195+
fight395791 = fight395791_(tree.text_content())
194196
data = {"weaponQuality": wep, "battleRoundId": hidden_id, "side": side, "value": value}
195197
data.update(convert_to_dict("".join(tree.xpath("//script[3]/text()")).split("&ip=")[1].split(";")[0]))
196-
return await get_content(f"{URL}fight395791.html", data=data)
198+
return await get_content(f"{URL}{fight395791}", data=data)
199+
197200

198201
async def location(server):
199202
"""getting current location"""

Time_saver/utils.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import re
2+
3+
4+
def fight395791_(r: str):
5+
fg_re = 'url: (\".*fight.*.html\")'
6+
return re.sub("[\"\']*", "", re.findall(fg_re, r)[0])

0 commit comments

Comments
 (0)