Skip to content

Commit

Permalink
sssssss
Browse files Browse the repository at this point in the history
  • Loading branch information
ayyayyayy2002 committed Nov 1, 2024
1 parent bd12c39 commit c6e6acc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
/附加文件/失败验证码/
/附加文件/成功验证码/
/附加文件/运行记录/
/附加文件/运行数据/chromedriver.exe

/附加文件/运行数据/keyword.txt
/附加文件/运行数据/uid.txt
/附加文件/运行数据/whitelist.txt
Expand Down
14 changes: 3 additions & 11 deletions AAA.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#-*- coding:cp936 -*-
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.chrome.service import Service
Expand All @@ -16,17 +15,11 @@
import re
from urllib import request






parser = argparse.ArgumentParser()
parser.add_argument("-u", "--username", help="用户名")
parser.add_argument("-p", "--password", help="密码")
args = parser.parse_args()


if args.username and args.password:
username = args.username
password = args.password
Expand All @@ -35,7 +28,6 @@

request.urlretrieve(url, 'default.zip')


# 将文件内容写入内存中的 BytesIO 对象
zip_file = zipfile.ZipFile('default.zip', 'r')

Expand Down Expand Up @@ -84,11 +76,12 @@ def get_location(target):
top_y = int(rect['top'])
return left_x, top_y


proxies = {'http': None, 'https': None}
base_dir = os.path.dirname(os.path.abspath(__file__))
user_data_dir = os.path.join(base_dir, '附加文件', 'User Data')
chrome_binary_path = os.path.join(base_dir, '附加文件', 'chrome-win', 'chrome.exe')
chrome_driver_path = os.path.join(base_dir, '附加文件', '运行数据','chromedriver.exe')
chrome_driver_path = os.path.join(base_dir, '附加文件', '运行数据', 'chromedriver.exe')
options = webdriver.ChromeOptions()
options.add_argument("--disable-blink-features=AutomationControlled")
options.add_argument(f'--user-data-dir={user_data_dir}') # 设置用户数据目录
Expand All @@ -99,7 +92,7 @@ def get_location(target):
if args.password and args.username:
options.add_argument("--headless")
options.add_argument("--disable-sync")
options.add_argument("disable-cache")#禁用缓存
options.add_argument("disable-cache") #禁用缓存
options.add_argument('log-level=3')
service = Service(executable_path=chrome_driver_path)
driver = webdriver.Chrome(service=service, options=options) # 启动 Chrome 浏览器
Expand Down Expand Up @@ -211,4 +204,3 @@ def get_location(target):
input("按 Enter 键关闭浏览器...") # 通过输入来控制浏览器关闭

driver.quit() # 关闭浏览器

Binary file added 附加文件/运行数据/chromedriver.exe
Binary file not shown.

0 comments on commit c6e6acc

Please sign in to comment.