Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
N
network-assets-reptile
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liyang
network-assets-reptile
Commits
350a7d1c
Commit
350a7d1c
authored
Jul 20, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:debug ptt
parent
c691b390
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
12 deletions
+2
-12
pc_ptt.py
pc_ptt.py
+1
-1
createBrowserDriver.py
utils/createBrowserDriver.py
+1
-11
No files found.
pc_ptt.py
View file @
350a7d1c
...
@@ -30,7 +30,7 @@ def reptile(browser=None, search_word=""):
...
@@ -30,7 +30,7 @@ def reptile(browser=None, search_word=""):
url
=
"https://www.ptt.cc/bbs/hotboards.html"
url
=
"https://www.ptt.cc/bbs/hotboards.html"
# 无头模式执行
# 无头模式执行
option
=
[
'--headless'
]
option
=
[
'--headless'
]
browser
=
browser
or
create
(
None
,
True
)
browser
=
browser
or
create
(
option
,
True
)
# 有头模式执行
# 有头模式执行
# browser = browser or create()
# browser = browser or create()
# 打开网页
# 打开网页
...
...
utils/createBrowserDriver.py
View file @
350a7d1c
...
@@ -80,7 +80,7 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
...
@@ -80,7 +80,7 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
# print("当前系统是 Linux")
# print("当前系统是 Linux")
# linux下运行记得加上这些参数 ----------------------------
# linux下运行记得加上这些参数 ----------------------------
# chrome_options.add_argument('--headless')
# chrome_options.add_argument('--headless')
options
.
add_argument
(
"--window-size=1920x1080"
)
# 设置窗口大小,这是一个常见的完全无头模式的设置
#
options.add_argument("--window-size=1920x1080") # 设置窗口大小,这是一个常见的完全无头模式的设置
options
.
add_argument
(
'--no-sandbox'
)
options
.
add_argument
(
'--no-sandbox'
)
options
.
add_argument
(
'--disable-gpu'
)
options
.
add_argument
(
'--disable-gpu'
)
options
.
add_argument
(
'--disable-dev-shm-usage'
)
options
.
add_argument
(
'--disable-dev-shm-usage'
)
...
@@ -92,15 +92,5 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
...
@@ -92,15 +92,5 @@ def create(option=None, using_user_data=True, web_browser="firefox"):
browser
=
webdriver
.
Firefox
(
options
=
options
)
browser
=
webdriver
.
Firefox
(
options
=
options
)
else
:
else
:
browser
=
webdriver
.
Chrome
(
options
=
options
)
browser
=
webdriver
.
Chrome
(
options
=
options
)
# -----------------------------------------------------------------
# else:
# # print("当前系统不是 Linux")
# # linux下运行记得加上这些参数 ----------------------------
# # chrome_options.add_argument('--headless') # 启用无头模式
# options.add_argument('--no-sandbox') # 禁用沙盒模式
# options.add_argument('--disable-gpu')
# options.add_argument('--disable-dev-shm-usage')
# # 创建浏览器驱动对象
# browser = webdriver.Chrome(options=options)
return
browser
return
browser
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment