se cambia el uso de google chrome por firefox para que se pueda utlizar en macpro late 2013
This commit is contained in:
1 parent
1c39f6f45f
commit
99a587c4da
10 files changed
+48
-40
No files matched your search
+9
-17
@@ -12,39 +12,31 @@ from get_token import (
|
||||
)
|
||||
# ============================================================================
|
||||
USER_AGENT = (
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) "
|
||||
"AppleWebKit/537.36 (KHTML, like Gecko) "
|
||||
"Chrome/120.0.0.0 Safari/537.36"
|
||||
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:121.0) "
|
||||
"Gecko/20100101 Firefox/121.0"
|
||||
)
|
||||
|
||||
# ============================================================================
|
||||
def chrome_instalado():
|
||||
def firefox_instalado():
|
||||
sistema = platform.system().lower()
|
||||
if sistema == "windows":
|
||||
return bool(shutil.which("chrome")) or any(
|
||||
return bool(shutil.which("firefox")) or any(
|
||||
os.path.exists(p) for p in [
|
||||
"C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
|
||||
"C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
|
||||
"C:\\Program Files\\Mozilla Firefox\\firefox.exe",
|
||||
"C:\\Program Files (x86)\\Mozilla Firefox\\firefox.exe",
|
||||
]
|
||||
)
|
||||
elif sistema == "darwin":
|
||||
return os.path.exists("/Applications/Google Chrome.app")
|
||||
return os.path.exists("/Applications/Firefox.app")
|
||||
elif sistema == "linux":
|
||||
return bool(shutil.which("google-chrome") or shutil.which("google-chrome-stable"))
|
||||
return bool(shutil.which("firefox") or shutil.which("firefox-esr"))
|
||||
return False
|
||||
|
||||
# ============================================================================
|
||||
def get_token_headless(timeout=90000):
|
||||
with sync_playwright() as p:
|
||||
browser = p.chromium.launch(
|
||||
channel="chrome",
|
||||
browser = p.firefox.launch(
|
||||
headless=True,
|
||||
args=[
|
||||
"--disable-blink-features=AutomationControlled",
|
||||
"--disable-popup-blocking",
|
||||
"--no-sandbox",
|
||||
"--window-size=1280,800",
|
||||
],
|
||||
)
|
||||
context = browser.new_context(
|
||||
viewport={"width": 1280, "height": 800},
|
||||
|
||||
Reference in new issue
Block a user