Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
crawler-py
Project
Project
Details
Activity
Releases
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
jimmy蒋政彪
crawler-py
Commits
31996e88
Commit
31996e88
authored
Aug 31, 2023
by
jimmy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
启动
parent
46d59467
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
crawler_baidu.py
crawler_baidu.py
+6
-6
No files found.
crawler_baidu.py
View file @
31996e88
...
...
@@ -21,13 +21,12 @@ def GetBaiduCompany(playwright: Playwright) -> int:
page
.
goto
(
url
)
all
=
page
.
locator
(
".lemma-summary"
)
.
all_text_contents
()
intro
=
re
.
sub
(
r'\[[\d-]+\]'
,
''
,
str
(
all
))
intro_new
=
str
(
intro
[
2
:
len
(
intro
)
-
2
])
new_string1
=
re
.
sub
(
r'\\n'
,
""
,
intro_new
)
new_string2
=
re
.
sub
(
r'\\xa0'
,
""
,
new_string1
)
crawler
.
Log
(
name
+
"-获取到百度数据:"
+
new_string2
)
crawler
.
Log
(
name
+
"-获取到百度数据:"
+
intro
)
if
name
!=
""
and
intro
!=
'[]'
:
intro_new
=
str
(
intro
[
2
:
len
(
intro
)
-
2
])
new_string1
=
re
.
sub
(
r'\\n'
,
""
,
intro_new
)
new_string2
=
re
.
sub
(
r'\\xa0'
,
""
,
new_string1
)
name2
=
crawler
.
SaveCompanyData
(
name
,
1
,
new_string2
)
if
name2
!=
""
:
crawler
.
Log
(
name2
+
":百度数据,写入成功"
)
...
...
@@ -36,6 +35,7 @@ def GetBaiduCompany(playwright: Playwright) -> int:
crawler
.
Log
(
name
+
":百度数据,写入失败"
)
return
100
else
:
name2
=
crawler
.
SaveCompanyData
(
name
,
1
,
""
)
crawler
.
Log
(
name
+
":百度数据,写入失败"
)
return
100
...
...
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