Refactor UC Mode

This commit is contained in:
Michael Mintz 2023-08-01 15:47:05 -04:00
parent a68f3e6304
commit b6120ae9b9
2 changed files with 13 additions and 5 deletions

View File

@ -183,10 +183,11 @@ def uc_special_open_if_cf(driver, url):
and has_cf(requests_get(url).text)
):
with driver:
time.sleep(0.25)
driver.execute_script('window.open("%s","_blank");' % url)
driver.reconnect(0.555)
driver.close()
driver.switch_to.window(driver.window_handles[-1])
driver.close()
driver.switch_to.window(driver.window_handles[-1])
time.sleep(0.11)
else:
driver.open(url) # The original one
return None
@ -195,8 +196,9 @@ def uc_special_open_if_cf(driver, url):
def uc_open(driver, url):
if (url.startswith("http:") or url.startswith("https:")):
with driver:
driver.open(url)
time.sleep(0.25)
driver.open(url)
time.sleep(0.11)
else:
driver.open(url) # The original one
return None
@ -205,10 +207,11 @@ def uc_open(driver, url):
def uc_open_with_tab(driver, url):
if (url.startswith("http:") or url.startswith("https:")):
with driver:
time.sleep(0.25)
driver.execute_script('window.open("%s","_blank");' % url)
driver.close()
driver.switch_to.window(driver.window_handles[-1])
time.sleep(0.25)
time.sleep(0.11)
else:
driver.open(url) # The original one
return None

View File

@ -208,6 +208,11 @@ class Patcher(object):
gen_js_whitespaces,
file_bin,
)
file_bin = re.sub(
b"window\\.cdc_[a-zA-Z0-9]{22}_(Array|Promise|Symbol)",
b"window\\.ccd_adoQpoasnaf67pfcZLmcfl_(Array|Promise|Symbol)",
file_bin,
)
file_bin = re.sub(
b"'\\$cdc_[a-zA-Z0-9]{22}_';",
gen_call_function_js_cache_name,