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
290453ef
Commit
290453ef
authored
Jul 20, 2023
by
liyang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:selenium 驱动配置
parent
8ba9b922
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
16 deletions
+15
-16
pc_ptt.py
pc_ptt.py
+15
-16
No files found.
pc_ptt.py
View file @
290453ef
...
...
@@ -94,7 +94,22 @@ def reptile(browser=None, search_word=""):
# 将datetime对象转换为时间戳(以秒为单位)
release_time
=
int
(
date_time
.
timestamp
())
# log.debug('开始判断类型')
try
:
# 找到所有第一级标签为 `div` 的元素
div_elements
=
soup
.
find_all
(
'div'
)
# log.debug("一级div数量:" + str(len(div_elements)))
# 逐个删除这些元素
for
div
in
div_elements
:
div
.
extract
()
# 删除第一级span
span_element
=
soup
.
find_all
(
'span'
)
# log.debug("一级span数量:" + str(len(span_element)))
for
span
in
span_element
:
span
.
extract
()
except
:
# log.debug("删除第一级div失败")
a
=
2
# ---------------- 判断类型 start ----------
# 类型
content_type
=
""
...
...
@@ -136,22 +151,6 @@ def reptile(browser=None, search_word=""):
except
:
# log.debug("查找所有的<a>标签失败")
a
=
1
try
:
# 找到所有第一级标签为 `div` 的元素
div_elements
=
soup
.
find_all
(
'div'
)
# log.debug("一级div数量:" + str(len(div_elements)))
# 逐个删除这些元素
for
div
in
div_elements
:
div
.
extract
()
# 删除第一级span
span_element
=
soup
.
find_all
(
'span'
)
# log.debug("一级span数量:" + str(len(span_element)))
for
span
in
span_element
:
span
.
extract
()
except
:
# log.debug("删除第一级div失败")
a
=
2
html
=
soup
.
prettify
()
.
replace
(
'amp;'
,
''
)
# ------------------ content 过滤 end--------------
...
...
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