mdbq 2.4.9__py3-none-any.whl → 2.5.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
mdbq/spider/aikucun.py
CHANGED
@@ -48,7 +48,7 @@ def get_cookie_aikucun():
|
|
48
48
|
"""
|
49
49
|
_url = 'https://gray-merc.aikucun.com/index.html'
|
50
50
|
cookie_path = os.path.join(set_support.SetSupport(dirname='support').dirname, 'cookies')
|
51
|
-
filename_aikucun = 'cookie_aikucun.
|
51
|
+
filename_aikucun = 'cookie_aikucun.json'
|
52
52
|
print(_url)
|
53
53
|
|
54
54
|
option = webdriver.ChromeOptions() # 浏览器启动选项
|
@@ -90,20 +90,27 @@ def get_cookie_aikucun():
|
|
90
90
|
print(f'{d_time} 登录成功,正在获取cookie...')
|
91
91
|
time.sleep(0.1)
|
92
92
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
93
|
+
# 将cookies保存为json格式
|
94
|
+
cookies_list = _driver.get_cookies()
|
95
|
+
|
96
|
+
json_file = os.path.join(cookie_path, filename_aikucun)
|
97
|
+
with open(json_file, 'w', encoding='utf-8') as f:
|
98
|
+
json.dump(cookies_list, f, ensure_ascii=False, sort_keys=True, indent=4)
|
99
|
+
print(f'cookie已保存: {json_file}')
|
100
|
+
|
101
|
+
# _file = os.path.join(cookie_path, filename_aikucun)
|
102
|
+
# with open(_file, 'w') as f:
|
103
|
+
# # 将cookies保存为json格式
|
104
|
+
# cookies_list = _driver.get_cookies()
|
105
|
+
# # for cookie in cookies_list:
|
106
|
+
# # # 该字段有问题所以删除就可以
|
107
|
+
# # if 'expiry' in cookie:
|
108
|
+
# # del cookie['expiry']
|
109
|
+
# # # if 'domain' in cookie:
|
110
|
+
# # # cookie['domain'] = '.taobao.com'
|
111
|
+
# cookies_list = json.dumps(cookies_list)
|
112
|
+
# f.write(cookies_list)
|
113
|
+
# print(f'cookie已保存: {_file}')
|
107
114
|
_driver.quit()
|
108
115
|
|
109
116
|
|
@@ -178,7 +185,7 @@ class AikuCun:
|
|
178
185
|
_driver.delete_all_cookies() # 首先清除浏览器打开已有的cookies
|
179
186
|
name_lists = os.listdir(self.cookie_path) # cookie 放在主目录下的 cookies 文件夹
|
180
187
|
for name in name_lists:
|
181
|
-
if shop_name in name and name.endswith('.
|
188
|
+
if shop_name in name and name.endswith('.json') and '~' not in name and '.DS' not in name:
|
182
189
|
with open(os.path.join(self.cookie_path, name), 'r') as f:
|
183
190
|
cookies_list = json.load(f) # 使用json读取cookies 注意读取的是文件 所以用load而不是loads
|
184
191
|
for cookie in cookies_list:
|
@@ -40,8 +40,8 @@ mdbq/pbix/refresh_all_old.py,sha256=_pq3WSQ728GPtEG5pfsZI2uTJhU8D6ra-htIk1JXYzw,
|
|
40
40
|
mdbq/req_post/__init__.py,sha256=jso1oHcy6cJEfa7udS_9uO5X6kZLoPBF8l3wCYmr5dM,18
|
41
41
|
mdbq/req_post/req_tb.py,sha256=PexWSCPJNM6Tv0ol4lAWIhlOwsAr_frnjtcdSHCFiek,36179
|
42
42
|
mdbq/spider/__init__.py,sha256=RBMFXGy_jd1HXZhngB2T2XTvJqki8P_Fr-pBcwijnew,18
|
43
|
-
mdbq/spider/aikucun.py,sha256=
|
44
|
-
mdbq-2.
|
45
|
-
mdbq-2.
|
46
|
-
mdbq-2.
|
47
|
-
mdbq-2.
|
43
|
+
mdbq/spider/aikucun.py,sha256=KdihSB3q44jsXUQAldfWRVfCSrEw2MNbM-_BhP_29g4,14448
|
44
|
+
mdbq-2.5.0.dist-info/METADATA,sha256=TMjdFAFFDBDfOiCXJ9fafyYlA4V71QedBfcoUPkiZjM,245
|
45
|
+
mdbq-2.5.0.dist-info/WHEEL,sha256=eOLhNAGa2EW3wWl_TU484h7q1UNgy0JXjjoqKoxAAQc,92
|
46
|
+
mdbq-2.5.0.dist-info/top_level.txt,sha256=2FQ-uLnCSB-OwFiWntzmwosW3X2Xqsg0ewh1axsaylA,5
|
47
|
+
mdbq-2.5.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|