Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
crawler
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
backend
crawler
Commits
3310832b
Commit
3310832b
authored
Jul 19, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
568a9046
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
1 deletion
+23
-1
crawler_xinyang_ask_service.py
dev/xinyang_ask_tag/crawler_xinyang_ask_service.py
+23
-1
No files found.
dev/xinyang_ask_tag/crawler_xinyang_ask_service.py
View file @
3310832b
...
@@ -13,7 +13,10 @@ from email.utils import formataddr
...
@@ -13,7 +13,10 @@ from email.utils import formataddr
from
urllib
import
error
from
urllib
import
error
import
requests
import
requests
# 导入requests.exceptions模块中的三种异常类
# 导入requests.exceptions模块中的三种异常类
from
requests.exceptions
import
ReadTimeout
,
HTTPError
,
RequestException
from
requests.exceptions
import
ReadTimeout
,
HTTPError
,
RequestException
,
ConnectionError
from
requests.packages.urllib3.exceptions
import
ReadTimeoutError
from
socket
import
timeout
from
retrying
import
retry
from
retrying
import
retry
import
pandas
as
pd
import
pandas
as
pd
...
@@ -103,6 +106,15 @@ class CrawlerMain(object):
...
@@ -103,6 +106,15 @@ class CrawlerMain(object):
except
RequestException
:
except
RequestException
:
print
(
'reqerror'
)
print
(
'reqerror'
)
pass
pass
except
socket
.
timeout
:
print
(
socket
.
timeout
)
pass
except
ReadTimeoutError
:
print
(
"ReadTimeoutError"
)
pass
except
ConnectionError
:
print
(
"ConnectionError"
)
pass
def
get_search_service_info_list
(
self
,
page
=
1
,
city_id
=-
1
,
query
=
""
):
def
get_search_service_info_list
(
self
,
page
=
1
,
city_id
=-
1
,
query
=
""
):
url
=
"https://www.soyoung.com/searchNew/product?"
\
url
=
"https://www.soyoung.com/searchNew/product?"
\
...
@@ -123,6 +135,15 @@ class CrawlerMain(object):
...
@@ -123,6 +135,15 @@ class CrawlerMain(object):
except
RequestException
:
except
RequestException
:
print
(
'reqerror'
)
print
(
'reqerror'
)
pass
pass
except
socket
.
timeout
:
print
(
socket
.
timeout
)
pass
except
ReadTimeoutError
:
print
(
"ReadTimeoutError"
)
pass
except
ConnectionError
:
print
(
"ConnectionError"
)
pass
def
get_services_list
(
self
,
res_json
,
query
=
""
,
city_name
=
""
):
def
get_services_list
(
self
,
res_json
,
query
=
""
,
city_name
=
""
):
...
@@ -148,6 +169,7 @@ class CrawlerMain(object):
...
@@ -148,6 +169,7 @@ class CrawlerMain(object):
def
get_service_base_info
(
self
,
pid
):
def
get_service_base_info
(
self
,
pid
):
service_info
=
dict
()
service_info
=
dict
()
res_json
,
url
=
self
.
get_service_base_info_list
(
pid
)
res_json
,
url
=
self
.
get_service_base_info_list
(
pid
)
if
res_json
:
res_json
=
res_json
.
xpath
(
res_json
=
res_json
.
xpath
(
"/html[1]/body[1]/div[@class='page-content']"
"/html[1]/body[1]/div[@class='page-content']"
"/div[@class='w1000']/div[@class='detail-wrap']/div[@class='width-control']/div"
"/div[@class='w1000']/div[@class='detail-wrap']/div[@class='width-control']/div"
...
...
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