Commit 4309e098 authored by 李小芳's avatar 李小芳

update

parent 4d1d6e83
...@@ -17,21 +17,21 @@ ...@@ -17,21 +17,21 @@
</Attribute> </Attribute>
</value> </value>
</entry> </entry>
<entry key="/dev/xinyang_ask_tag/soyoung_service_1.csv"> <entry key="/dev/xinyang_ask_tag/soyoung_service_cika.csv">
<value> <value>
<Attribute> <Attribute>
<option name="separator" value="," /> <option name="separator" value="," />
</Attribute> </Attribute>
</value> </value>
</entry> </entry>
<entry key="/dev/xinyang_ask_tag/soyoung_service_cika.csv"> <entry key="/dev/xinyang_ask_tag/医院尾款劵数据.csv">
<value> <value>
<Attribute> <Attribute>
<option name="separator" value="," /> <option name="separator" value="," />
</Attribute> </Attribute>
</value> </value>
</entry> </entry>
<entry key="/dev/xinyang_ask_tag/soyoung_service_write_cika.csv"> <entry key="/dev/xinyang_ask_tag/更美机构商务信息.csv">
<value> <value>
<Attribute> <Attribute>
<option name="separator" value="," /> <option name="separator" value="," />
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding">
<file url="file://$PROJECT_DIR$/dev/xinyang_ask_tag/更美机构商务信息.csv" charset="UTF-8" />
</component>
</project>
\ No newline at end of file
...@@ -5,12 +5,13 @@ import re ...@@ -5,12 +5,13 @@ import re
from pypinyin import lazy_pinyin from pypinyin import lazy_pinyin
import time import time
import random import random
import csv
monkey.patch_all() monkey.patch_all()
def get_service_info(spu_id, url, ids_bug): def get_service_info(spu_id, url, ids_bug):
time.sleep(random.uniform(1, 2)) time.sleep(random.uniform(2, 3))
url = url + "?tab=0&rj=0" url = url + "?tab=0&rj=0"
headers = { headers = {
...@@ -56,7 +57,7 @@ def gevent_test(): ...@@ -56,7 +57,7 @@ def gevent_test():
gevent.joinall(tasks) gevent.joinall(tasks)
def get_cika_info_to_csv(): def get_cika_info_to_csv(get_data=False):
read_file = open("soyoung_service.csv", "r", encoding="utf-8") read_file = open("soyoung_service.csv", "r", encoding="utf-8")
write_file = open("soyoung_service_cika.csv", "a+", encoding="utf-8") write_file = open("soyoung_service_cika.csv", "a+", encoding="utf-8")
all_cika_title = list() all_cika_title = list()
...@@ -66,7 +67,7 @@ def get_cika_info_to_csv(): ...@@ -66,7 +67,7 @@ def get_cika_info_to_csv():
try: try:
cika_price_dict = dict() cika_price_dict = dict()
print("index:", item.strip().split(",")[0]) print("index:", item.strip().split(",")[0])
if int(item.strip().split(",")[0]) > 34645: if int(item.strip().split(",")[0]) > 64526:
service_id = item.strip().split(",")[2] service_id = item.strip().split(",")[2]
url = item.strip().split(",")[-1] url = item.strip().split(",")[-1]
if service_id in have_read_service: if service_id in have_read_service:
...@@ -74,12 +75,16 @@ def get_cika_info_to_csv(): ...@@ -74,12 +75,16 @@ def get_cika_info_to_csv():
else: else:
have_read_service.append(service_id) have_read_service.append(service_id)
sub_title_dict = get_service_info(str(service_id), url, ids_bug) sub_title_dict = get_service_info(str(service_id), url, ids_bug)
if sub_title_dict: if get_data == False:
all_cika_title.extend(sub_title_dict.keys()) if sub_title_dict:
cika_price_dict[service_id] = sub_title_dict all_cika_title.extend(sub_title_dict.keys())
print(cika_price_dict) cika_price_dict[service_id] = sub_title_dict
write_file.write(str(cika_price_dict)) print(cika_price_dict)
write_file.write("\n") write_file.write(str(cika_price_dict))
write_file.write("\n")
else:
return sub_title_dict
except Exception as e: except Exception as e:
print(e) print(e)
pass pass
...@@ -89,5 +94,42 @@ def get_cika_info_to_csv(): ...@@ -89,5 +94,42 @@ def get_cika_info_to_csv():
write_file.close() write_file.close()
def read_cika_info():
all_cika_title = {}
cika_file = open("soyoung_service_cika.csv", "r", encoding="utf-8")
for item in cika_file.readlines():
cika = eval(item)
for key, values in cika.items():
all_cika_title[key] = values
print(all_cika_title)
cika_file.close()
return all_cika_title
def np_write_csv_data():
all_cika_title = read_cika_info()
write_file = open("soyoung_service_write_cika.csv", "a+", encoding="utf-8")
# /Users/edz/Desktop/xinyang.csv
with open("soyoung_service.csv", encoding='utf-8') as f:
reader = csv.reader(f)
header_row = next(reader)
print(header_row)
for row in reader:
service_id = row[2]
cika_info = all_cika_title.get(service_id)
if cika_info:
print('cika_info:', cika_info)
write_file.write(str(row.append(cika_info)))
write_file.write("\n")
else:
sub_title_dict = get_cika_info_to_csv(get_data=True)
print('sub_title_dict:', sub_title_dict)
write_file.write(str(row.append(sub_title_dict)))
write_file.write("\n")
write_file.close()
if __name__ == '__main__': if __name__ == '__main__':
get_cika_info_to_csv() get_cika_info_to_csv()
import csv
def read_cika_info():
all_cika_title = {}
cika_file = open("soyoung_service_cika.csv", "r", encoding="utf-8")
for item in cika_file.readlines():
cika = eval(item)
for key, values in cika.items():
all_cika_title[key] = values
print(all_cika_title)
cika_file.close()
return all_cika_title
def np_write_csv_data():
all_cika_title = read_cika_info()
write_file = open("soyoung_service_write_cika.csv", "a+", encoding="utf-8")
# /Users/edz/Desktop/xinyang.csv
with open("soyoung_service.csv", encoding='utf-8') as f:
reader = csv.reader(f)
header_row = next(reader)
print(header_row)
for row in reader:
service_id = row[2]
cika_info = all_cika_title.get(service_id)
if cika_info:
print('cika_info:', cika_info)
write_file.write(str(row.append(cika_info)))
write_file.write("\n")
write_file.close()
if __name__ == '__main__':
np_write_csv_data()
This diff is collapsed.
This diff is collapsed.
"大区", "城市", "商务", "机构名称", "满", "减", "劣势/缺失", "到期时间", "查到劣势日期", "最晚补券时间"
,北京,,北京好年华眼整形中心,10000,1000,,2027-02-28 到期,2021-08-20 17:36:56,
,北京,,北京好年华眼整形中心,100,5,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京好年华眼整形中心,500,30,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京清木医疗美容诊所,2000,100,,2023-03-31 到期,2021-08-20 17:36:56,
,北京,,北京清木医疗美容诊所,10000,300,,2022-06-30 到期,2021-08-20 17:36:56,
,北京,,北京清木医疗美容诊所,999,50,,2023-04-30 到期,2021-08-20 17:36:56,
,北京,,北京清木医疗美容诊所,2000,100,,2024-04-30 到期,2021-08-20 17:36:56,
,北京,,北京清木医疗美容诊所,300,30,,2024-04-30 到期,2021-08-20 17:36:56,
,北京,,美诗沁世茂医疗美容,20,20,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,美诗沁世茂医疗美容,500,50,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,美诗沁世茂医疗美容,5000,600,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,3000,500,,2026-03-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,223,222,,2024-04-26 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,9999,2000,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,9999,2000,,2025-05-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,9999,2000,,2025-05-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,2000,1000,,2025-05-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,9999,2000,,2028-05-31 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,1000,100,,2028-06-30 到期,2021-08-20 17:36:56,
,北京,,北京新星靓医疗美容医院,2000,200,,2024-06-28 到期,2021-08-20 17:36:56,
,北京,,北京润美玉之光医疗美容,1000,50,,2021-12-31 到期,2021-08-20 17:36:56,
,北京,,北京润美玉之光医疗美容,3000,150,,2021-12-31 到期,2021-08-20 17:36:56,
,北京,,北京润美玉之光医疗美容,5000,300,,2021-12-31 到期,2021-08-20 17:36:56,
,北京,,北京润美玉之光医疗美容,10000,500,,2021-12-31 到期,2021-08-20 17:36:56,
,北京,,北京叶子整形美容医院,1000,100,,2021-09-26 到期,2021-08-20 17:36:56,
,北京,,北京亚楠容悦医疗美容,100,8,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京亚楠容悦医疗美容,3000,100,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京画美医疗美容医院,10000,1000,,2022-07-31 到期,2021-08-20 17:36:56,
,北京,,北京画美医疗美容医院,5000,500,,2022-07-31 到期,2021-08-20 17:36:56,
,北京,,北京画美医疗美容医院,1500,200,,2022-07-31 到期,2021-08-20 17:36:56,
,北京,,北京画美医疗美容医院,500,50,,2022-07-31 到期,2021-08-20 17:36:56,
,北京,,北京爱悦丽格医疗美容,500,50,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京爱悦丽格医疗美容,1000,100,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,上上相整形·脂肪骨性移植,15000,350,,2021-10-31 到期,2021-08-20 17:36:56,
,北京,,上上相整形·脂肪骨性移植,30000,700,,2021-10-31 到期,2021-08-20 17:36:56,
,北京,,北京嘉禾医疗美容,500,50,,2022-06-30 到期,2021-08-20 17:36:56,
,北京,,北京嘉禾医疗美容,999,100,,2022-06-30 到期,2021-08-20 17:36:56,
,北京,,北京嘉禾医疗美容,1999,200,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,北京嘉禾医疗美容,4999,500,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,北京嘉禾医疗美容,19999,2000,,2022-08-31 到期,2021-08-20 17:36:56,
,北京,,北京雅靓医疗美容,1000,100,,2021-12-31 到期,2021-08-20 17:36:56,
,北京,,北京俊泰美好医疗美容门诊部(鼻修复及不明注射物取出中心),800,100,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京俊泰美好医疗美容门诊部(鼻修复及不明注射物取出中心),500,50,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京华悦府医疗美容,999,50,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京华悦府医疗美容,3980,2000,,2021-10-31 到期,2021-08-20 17:36:56,
,北京,,北京艺星医疗美容医院,10999,500,,2021-08-31 到期,2021-08-20 17:36:56,
,北京,,北京艺星医疗美容医院,1999,200,,2021-10-31 到期,2021-08-20 17:36:56,
,北京,,北京艺星医疗美容医院,4000,300,,2021-10-31 到期,2021-08-20 17:36:56,
,北京,,北京艺星医疗美容医院,8000,800,,2021-10-31 到期,2021-08-20 17:36:56,
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment