Skip to content

Commit

Permalink
fix: remove jiter patch
Browse files Browse the repository at this point in the history
  • Loading branch information
QIN2DIM committed Jun 3, 2022
1 parent d468106 commit 3f32b54
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 32 deletions.
6 changes: 5 additions & 1 deletion src/services/bricklayer/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ def is_challenge_image_clickable():
self.log("原子實例被檢測", resp=error_text)
raise CookieRefreshException(error_text)
return self.CHALLENGE_CRASH, "登入页面错误回复"
elif "there was a socket open error" in error_text:
return (self.CHALLENGE_CRASH, "there was a socket open error")
else:
self.log("認證失敗", resp=error_text)
_unknown = AuthUnknownException(msg=error_text)
Expand Down Expand Up @@ -597,7 +599,9 @@ def surprise_warning_purchase(ctx: ChallengerContext) -> Optional[bool]:

if "成人内容" in surprise_warning:
WebDriverWait(ctx, 2, ignored_exceptions=ElementClickInterceptedException).until(
EC.element_to_be_clickable((By.XPATH, "//div[@data-component='AgeGateTakeover']/button"))
EC.element_to_be_clickable(
(By.XPATH, "//div[@data-component='AgeGateTakeover']/button")
)
).click()
return True
if "内容品当前在您所在平台或地区不可用。" in surprise_warning:
Expand Down
4 changes: 1 addition & 3 deletions src/services/bricklayer/game.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ def cart_balancing(self, ctx_cookies: List[dict], ctx_session, init=True, tun=Fa
"""
_message = "将购物车商品移至愿望清单" if init else "正在审核移动操作"
logger.debug(
ToolBox.runtime_report(
motive="REMOVE", action_name=self.action_name, message=_message
)
ToolBox.runtime_report(motive="REMOVE", action_name=self.action_name, message=_message)
)
self._reset_page(
ctx=ctx_session,
Expand Down
20 changes: 11 additions & 9 deletions src/services/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -463,25 +463,27 @@ def promotions_filter(self):

def inline_bricklayer(self):
# 将购物车商品移至愿望清单
# self.bricklayer.cart_balancing(self._ctx_cookies, self._ctx_session, tun=self.tun)
if self.task_queue_worker.qsize() > 1:
self.bricklayer.cart_balancing(self._ctx_cookies, self._ctx_session, tun=self.tun)

# 将商品逐渐添加至购物车
# GET/ADD 模式切换: 任务数大于1时使用 AddMode
while not self.task_queue_worker.empty():
job = self.task_queue_worker.get()
# fixme: patch
if "bioshock-the-collection" in job["url"]:
if self.task_queue_worker.empty():
self.bricklayer.claim_mode = self.bricklayer.CLAIM_MODE_GET
else:
SynergyTunnel.LEAVES.append(job["url"])
self.bricklayer.claim_stabilizer(job["url"], self._ctx_cookies, self._ctx_session)
job["review"] = True
self.promotions_review.append(job)
# SynergyTunnel.LEAVES.append(job["url"])

# 清空购物车
# for leave in SynergyTunnel.LEAVES:
# if not SynergyTunnel.get_combat(leave):
# self.bricklayer.claim_booster(self._ctx_cookies, self._ctx_session)
# SynergyTunnel.set_combat(leave, self.coco)
# break
for leave in SynergyTunnel.LEAVES:
if not SynergyTunnel.get_combat(leave):
self.bricklayer.claim_booster(self._ctx_cookies, self._ctx_session)
SynergyTunnel.set_combat(leave, self.coco)
break


class UnrealClaimerInstance(BaseInstance):
Expand Down
20 changes: 10 additions & 10 deletions src/services/scaffold.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ def challenge(silence: Optional[bool] = True):

@staticmethod
def get(
debug: Optional[bool] = None,
cache: Optional[bool] = True,
dlc: Optional[bool] = False,
unreal: Optional[bool] = False,
silence: Optional[bool] = True,
dev: Optional[str] = None
debug: Optional[bool] = None,
cache: Optional[bool] = True,
dlc: Optional[bool] = False,
unreal: Optional[bool] = False,
silence: Optional[bool] = True,
dev: Optional[str] = None,
):
"""
Expand Down Expand Up @@ -111,10 +111,10 @@ def get(

@staticmethod
def claim(
silence: Optional[bool] = True,
ignore: Optional[bool] = False,
unreal: Optional[bool] = False,
tun: Optional[bool] = True,
silence: Optional[bool] = True,
ignore: Optional[bool] = False,
unreal: Optional[bool] = False,
tun: Optional[bool] = True,
):
"""
Introduction
Expand Down
3 changes: 2 additions & 1 deletion src/services/utils/armor/anti_hcaptcha/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,11 @@ def get_label(self, ctx: Chrome):
:param ctx:
:return:
"""

time.sleep(1)
try:
label_obj = WebDriverWait(ctx, 30, ignored_exceptions=ElementNotVisibleException).until(
EC.presence_of_element_located((By.XPATH, "//div[@class='prompt-text']"))
EC.presence_of_element_located((By.XPATH, "//h2[@class='prompt-text']"))
)
except TimeoutException:
raise ChallengeReset("人机挑战意外通过")
Expand Down
16 changes: 8 additions & 8 deletions src/services/utils/toolbox/toolbox.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,10 @@ def for_telegram(self, server: str):

# fixme
# _preview = [f"[​]({random.choice(inline_docker).get('url', self._copyright)})"]
_preview = [f"[​](https://cdn2.unrealengine.com/egs-bioshockthecollection-massmediagames-g1c-00"
f"-1920x1080-4269d4245e1e.jpg?h=1080&resize=1&w=1920)"]
_preview = [
f"[​](https://cdn1.epicgames.com/offer/d5241c76f178492ea1540fce45616757/"
f"egs-vault-w3-1920x1080_1920x1080-4a501d33fb4ac641e3e1e290dcc0e6c1)"
]

_title = [f"*{self.title}*"]

Expand Down Expand Up @@ -330,9 +332,7 @@ def get_ctx(silence: Optional[bool] = None, fast: Optional[bool] = False) -> Sta
return Chrome(ChromeDriverManager(log_level=0).install(), options=options)


def get_challenge_ctx(
silence: Optional[bool] = None, user_data_dir: Optional[str] = None
) -> ChallengerContext:
def get_challenge_ctx(silence: Optional[bool] = None) -> ChallengerContext:
"""挑战者驱动 用于处理人机挑战"""
logger.debug(ToolBox.runtime_report("__Context__", "ACTIVATE", "🎮 激活挑战者上下文"))

Expand All @@ -346,18 +346,18 @@ def get_challenge_ctx(
return uc.Chrome(
headless=silence,
options=options,
use_subprocess=True,
driver_executable_path=driver_executable_path,
user_data_dir=user_data_dir,
)
# 避免核心并行
except OSError:
return uc.Chrome(headless=silence, options=options, user_data_dir=user_data_dir)
return uc.Chrome(headless=silence, options=options, use_subprocess=True)
# 棄用索引緩存
except WebDriverException:
if version_main.isdigit():
return uc.Chrome(
headless=silence,
options=options,
version_main=int(version_main),
user_data_dir=user_data_dir,
use_subprocess=True,
)

0 comments on commit 3f32b54

Please sign in to comment.