애니라이프 추가 및 애니24 수정 2022.09.25
os platform fix
This commit is contained in:
@@ -6,6 +6,7 @@ from datetime import datetime
|
|||||||
import hashlib
|
import hashlib
|
||||||
import re
|
import re
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import platform
|
||||||
|
|
||||||
import lxml.etree
|
import lxml.etree
|
||||||
|
|
||||||
@@ -15,7 +16,13 @@ from lxml import html
|
|||||||
from urllib import parse
|
from urllib import parse
|
||||||
import urllib
|
import urllib
|
||||||
|
|
||||||
packages = ["beautifulsoup4", "requests-cache", "cloudscraper", "selenium_stealth", "webdriver_manager"]
|
packages = [
|
||||||
|
"beautifulsoup4",
|
||||||
|
"requests-cache",
|
||||||
|
"cloudscraper",
|
||||||
|
"selenium_stealth",
|
||||||
|
"webdriver_manager",
|
||||||
|
]
|
||||||
for package in packages:
|
for package in packages:
|
||||||
try:
|
try:
|
||||||
import package
|
import package
|
||||||
@@ -80,6 +87,8 @@ class LogicAniLife(LogicModuleBase):
|
|||||||
episode_url = None
|
episode_url = None
|
||||||
cookies = None
|
cookies = None
|
||||||
|
|
||||||
|
os_platform = platform.system()
|
||||||
|
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
headers = {
|
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",
|
"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_argument("--no-sandbox")
|
||||||
options.add_experimental_option("excludeSwitches", ["enable-automation"])
|
options.add_experimental_option("excludeSwitches", ["enable-automation"])
|
||||||
options.add_experimental_option("useAutomationExtension", False)
|
options.add_experimental_option("useAutomationExtension", False)
|
||||||
# 크롬드라이버 경로
|
|
||||||
driver_path = "./bin/Darwin/chromedriver"
|
if LogicAniLife.os_platform == 'Darwin':
|
||||||
# driver = webdriver.Chrome(executable_path=driver_path, chrome_options=options)
|
# 크롬드라이버 경로
|
||||||
driver = webdriver.Chrome(
|
driver_path = "./bin/Darwin/chromedriver"
|
||||||
ChromeDriverManager().install(), chrome_options=options
|
# 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(
|
stealth(
|
||||||
driver,
|
driver,
|
||||||
languages=["en-US", "en"],
|
languages=["en-US", "en"],
|
||||||
|
|||||||
Reference in New Issue
Block a user