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
9ea6170b
Commit
9ea6170b
authored
Jul 27, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:ptt 加速
parent
98dcc42f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
12 deletions
+8
-12
pc_ptt.py
pc_ptt.py
+8
-12
No files found.
pc_ptt.py
View file @
9ea6170b
...
...
@@ -67,7 +67,14 @@ def reptile(browser=None, search_word=""):
log
.
debug
(
f
"正在爬取分类:{type_title}-第{index_two + 1}条"
)
print
(
"当前连接:"
+
str
(
browser
.
current_url
))
print
(
data
[
len
(
data
)
-
1
][
"title"
])
# 使用正则表达式进行匹配关键词
if
re
.
findall
(
search_word
,
element_list
[
index_two
]
.
text
):
# log.debug(f"找到了匹配的字符串:{matches}")
error
=
""
else
:
# log.debug("未找到匹配的字符串")
# 退出本次迭代,进入下一次迭代
continue
# 标题不包含"公告"和"看板"
if
re
.
findall
(
"公告"
,
element_list
[
index_two
]
.
text
)
or
re
.
findall
(
"看板"
,
element_list
[
index_two
]
.
text
):
a
=
1
...
...
@@ -190,17 +197,6 @@ def reptile(browser=None, search_word=""):
"picture_url"
:
","
.
join
(
picture_url
)
}
# --------------- 组装数据 end---------------------
# 使用正则表达式进行匹配
# log.debug(f"关键词:{search_word}-{element_title.text}")
matches
=
re
.
findall
(
search_word
,
element_title
.
text
)
# 打印匹配结果
if
matches
:
# log.debug(f"找到了匹配的字符串:{matches}")
data
.
append
(
obj
)
else
:
# log.debug("未找到匹配的字符串")
a
=
3
# 浏览器返回上一页
browser
.
back
()
time
.
sleep
(
0.1
)
...
...
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