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
fa1d3fcd
Commit
fa1d3fcd
authored
Jul 20, 2021
by
李小芳
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add
parent
ab0c6648
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
27 deletions
+28
-27
crawler_xinyang_ask_service_city.py
dev/xinyang_ask_tag/crawler_xinyang_ask_service_city.py
+28
-27
No files found.
dev/xinyang_ask_tag/crawler_xinyang_ask_service_city.py
View file @
fa1d3fcd
...
@@ -145,33 +145,34 @@ class CrawlerMain(object):
...
@@ -145,33 +145,34 @@ class CrawlerMain(object):
def
get_services_list
(
self
,
res_json
,
query
=
""
,
city_name
=
""
,
city_id
=-
1
):
def
get_services_list
(
self
,
res_json
,
query
=
""
,
city_name
=
""
,
city_id
=-
1
):
page_service_pids
=
[]
page_service_pids
=
[]
current_end_flat
=
False
current_end_flat
=
False
for
service
in
res_json
.
get
(
"responseData"
,
{})
.
get
(
"arr_product"
,
[]):
if
res_json
:
current_city
=
service
.
get
(
"district_2"
)
for
service
in
res_json
.
get
(
"responseData"
,
{})
.
get
(
"arr_product"
,
[]):
if
int
(
current_city
)
==
int
(
city_id
):
current_city
=
service
.
get
(
"district_2"
)
pid
=
service
.
get
(
"pid"
)
if
int
(
current_city
)
==
int
(
city_id
):
spu_id
=
service
.
get
(
"spu_id"
)
pid
=
service
.
get
(
"pid"
)
doctor_name
=
service
.
get
(
"doctor_name"
)
spu_id
=
service
.
get
(
"spu_id"
)
hospital_name
=
service
.
get
(
"hospital_name"
)
doctor_name
=
service
.
get
(
"doctor_name"
)
service_info
=
self
.
get_service_base_info
(
pid
)
hospital_name
=
service
.
get
(
"hospital_name"
)
service_info
[
'美购id'
]
=
spu_id
service_info
=
self
.
get_service_base_info
(
pid
)
service_info
[
'sku原价'
]
=
service
.
get
(
"price_origin"
)
service_info
[
'美购id'
]
=
spu_id
service_info
[
'sku活动价'
]
=
service
.
get
(
"price_online"
)
service_info
[
'sku原价'
]
=
service
.
get
(
"price_origin"
)
service_info
[
'机构等级'
]
=
service
.
get
(
"avg_score"
)
service_info
[
'sku活动价'
]
=
service
.
get
(
"price_online"
)
service_info
[
'美购名称'
]
=
service
.
get
(
"title"
)
service_info
[
'机构等级'
]
=
service
.
get
(
"avg_score"
)
service_info
[
'销量'
]
=
service
.
get
(
"order_cnt"
)
service_info
[
'美购名称'
]
=
service
.
get
(
"title"
)
service_info
[
'skuid'
]
=
pid
service_info
[
'销量'
]
=
service
.
get
(
"order_cnt"
)
service_info
[
'医生名'
]
=
doctor_name
service_info
[
'skuid'
]
=
pid
service_info
[
'医院名称'
]
=
hospital_name
service_info
[
'医生名'
]
=
doctor_name
service_info
[
'query词'
]
=
query
service_info
[
'医院名称'
]
=
hospital_name
service_info
[
'城市'
]
=
city_name
service_info
[
'query词'
]
=
query
service_info
[
'平台'
]
=
"新氧"
service_info
[
'城市'
]
=
city_name
service_info
[
'链接'
]
=
"https://y.soyoung.com/cp{}"
.
format
(
pid
)
service_info
[
'平台'
]
=
"新氧"
service_info
[
'链接'
]
=
"https://y.soyoung.com/cp{}"
.
format
(
pid
)
sort_service_info
=
sorted
(
service_info
.
items
(),
key
=
lambda
x
:
self
.
title
.
index
(
x
[
0
]),
reverse
=
False
)
page_service_pids
.
append
(
dict
(
sort_service_info
))
sort_service_info
=
sorted
(
service_info
.
items
(),
key
=
lambda
x
:
self
.
title
.
index
(
x
[
0
]),
reverse
=
False
)
else
:
page_service_pids
.
append
(
dict
(
sort_service_info
))
current_end_flat
=
True
else
:
break
current_end_flat
=
True
break
return
page_service_pids
,
current_end_flat
return
page_service_pids
,
current_end_flat
def
get_service_base_info
(
self
,
pid
):
def
get_service_base_info
(
self
,
pid
):
...
...
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