애니라이프 추가 및 애니24 수정 2022.09.25
os platform fix
This commit is contained in:
@@ -6,6 +6,7 @@ from datetime import datetime
|
||||
import hashlib
|
||||
import re
|
||||
import asyncio
|
||||
import platform
|
||||
|
||||
import lxml.etree
|
||||
|
||||
@@ -15,7 +16,13 @@ from lxml import html
|
||||
from urllib import parse
|
||||
import urllib
|
||||
|
||||
packages = ["beautifulsoup4", "requests-cache", "cloudscraper", "selenium_stealth", "webdriver_manager"]
|
||||
packages = [
|
||||
"beautifulsoup4",
|
||||
"requests-cache",
|
||||
"cloudscraper",
|
||||
"selenium_stealth",
|
||||
"webdriver_manager",
|
||||
]
|
||||
for package in packages:
|
||||
try:
|
||||
import package
|
||||
@@ -80,6 +87,8 @@ class LogicAniLife(LogicModuleBase):
|
||||
episode_url = None
|
||||
cookies = None
|
||||
|
||||
os_platform = platform.system()
|
||||
|
||||
session = requests.Session()
|
||||
headers = {
|
||||
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/104.0.0.0 Safari/537.36",
|
||||
@@ -383,12 +392,18 @@ class LogicAniLife(LogicModuleBase):
|
||||
options.add_argument("--no-sandbox")
|
||||
options.add_experimental_option("excludeSwitches", ["enable-automation"])
|
||||
options.add_experimental_option("useAutomationExtension", False)
|
||||
|
||||
if LogicAniLife.os_platform == 'Darwin':
|
||||
# 크롬드라이버 경로
|
||||
driver_path = "./bin/Darwin/chromedriver"
|
||||
# driver = webdriver.Chrome(executable_path=driver_path, chrome_options=options)
|
||||
driver = webdriver.Chrome(
|
||||
ChromeDriverManager().install(), chrome_options=options
|
||||
)
|
||||
else:
|
||||
driver_path = f"./bin/{LogicAniLife.os_platform}/chromedriver"
|
||||
driver = webdriver.Chrome(executable_path=driver_path, chrome_options=options)
|
||||
|
||||
stealth(
|
||||
driver,
|
||||
languages=["en-US", "en"],
|
||||
|
||||
Reference in New Issue
Block a user