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
baa783ca
Commit
baa783ca
authored
Jul 27, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:ptt debug
parent
d01df965
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
3 deletions
+4
-3
pc_ptt.py
pc_ptt.py
+4
-3
No files found.
pc_ptt.py
View file @
baa783ca
...
...
@@ -59,7 +59,7 @@ def reptile(browser=None, search_word=""):
element_list
=
browser
.
find_elements
(
'xpath'
,
"//div[@class='r-ent']//div[@class='title']//a"
)
length_two
=
len
(
element_list
)
for
index_two
in
range
(
length_two
):
print
(
element_list
[
index_two
]
.
text
)
#
print(element_list[index_two].text)
# 标题不包含"公告"和"看板"
if
re
.
findall
(
"公告"
,
element_list
[
index_two
]
.
text
)
or
re
.
findall
(
"看板"
,
element_list
[
index_two
]
.
text
):
a
=
1
...
...
@@ -75,6 +75,7 @@ def reptile(browser=None, search_word=""):
time
.
sleep
(
0.1
)
# 原链接
browser_current_url
=
browser
.
current_url
# print(browser_current_url)
# log.debug('网页链接' + str(browser_current_url))
try
:
# 获取帖子详情
...
...
@@ -215,11 +216,11 @@ def reptile(browser=None, search_word=""):
log
.
debug
(
'save file success'
)
else
:
log
.
debug
(
'save file failed'
)
script_close
(
browser
)
#
script_close(browser)
else
:
# 爬取数据为空
log
.
info
(
"未爬取到数据"
)
script_close
(
browser
)
#
script_close(browser)
def
script_close
(
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