lazyad 0.0.15__py3-none-any.whl → 0.0.17__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.
Potentially problematic release.
This version of lazyad might be problematic. Click here for more details.
- lazyad/crawlers/chuangliang.py +264 -13
- {lazyad-0.0.15.dist-info → lazyad-0.0.17.dist-info}/METADATA +1 -1
- {lazyad-0.0.15.dist-info → lazyad-0.0.17.dist-info}/RECORD +5 -5
- {lazyad-0.0.15.dist-info → lazyad-0.0.17.dist-info}/WHEEL +0 -0
- {lazyad-0.0.15.dist-info → lazyad-0.0.17.dist-info}/top_level.txt +0 -0
lazyad/crawlers/chuangliang.py
CHANGED
|
@@ -1,20 +1,24 @@
|
|
|
1
1
|
from lazysdk import lazyrequests
|
|
2
|
+
from lazysdk import lazytime
|
|
3
|
+
import showlog
|
|
2
4
|
import copy
|
|
5
|
+
import json
|
|
6
|
+
|
|
3
7
|
|
|
4
8
|
default_headers = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
"Accept": "application/json, text/plain, */*",
|
|
10
|
+
"Accept-Encoding": "gzip, deflate",
|
|
11
|
+
"Accept-Language": "zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-US;q=0.3,en;q=0.2",
|
|
12
|
+
"Connection": "keep-alive",
|
|
13
|
+
"Host": "cli2.mobgi.com",
|
|
14
|
+
"Origin": "https://cl.mobgi.com",
|
|
15
|
+
"Referer": "https://cl.mobgi.com/",
|
|
16
|
+
"Sec-Fetch-Dest": "empty",
|
|
17
|
+
"Sec-Fetch-Mode": "cors",
|
|
18
|
+
"Sec-Fetch-Site": "same-site",
|
|
19
|
+
"TE": "trailers",
|
|
20
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0",
|
|
21
|
+
}
|
|
18
22
|
|
|
19
23
|
|
|
20
24
|
def get_media_account(
|
|
@@ -52,3 +56,250 @@ def get_media_account(
|
|
|
52
56
|
headers=headers,
|
|
53
57
|
return_json=True
|
|
54
58
|
)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def get_ad_report(
|
|
62
|
+
cookie: str,
|
|
63
|
+
media_type: str,
|
|
64
|
+
start_date: str = None,
|
|
65
|
+
end_date: str = None,
|
|
66
|
+
page: int = 1,
|
|
67
|
+
page_size: int = 20,
|
|
68
|
+
sort_field: str = "cost",
|
|
69
|
+
time_dim: str = "sum",
|
|
70
|
+
sort_direction: str = "desc",
|
|
71
|
+
data_dim: str = "ad",
|
|
72
|
+
data_type: str = "list",
|
|
73
|
+
conditions: dict = None,
|
|
74
|
+
kpis: list = None,
|
|
75
|
+
relate_dims: list = None,
|
|
76
|
+
):
|
|
77
|
+
"""
|
|
78
|
+
报表-广告报表
|
|
79
|
+
:param cookie:
|
|
80
|
+
:param start_date: 数据开始日期,默认为当日
|
|
81
|
+
:param end_date: 数据结束日期,默认为当日
|
|
82
|
+
:param page: 页码
|
|
83
|
+
:param page_size: 每页数量
|
|
84
|
+
:param media_type: 媒体:gdt_new|广点通(新指标体系),toutiao_upgrade|今日头条2.0,aggregate|不限
|
|
85
|
+
:param sort_field: 排序字段
|
|
86
|
+
:param time_dim: 数据的时间维度汇总方式
|
|
87
|
+
:param sort_direction: 排序方式,desc降序
|
|
88
|
+
:param data_dim: 数据维度,advertiser_id:账户,ad:广告
|
|
89
|
+
:param data_type:
|
|
90
|
+
:param conditions: 搜索条件
|
|
91
|
+
:param kpis: 需要获取的字段
|
|
92
|
+
:param relate_dims: 关联维度,advertiser_id:账户
|
|
93
|
+
:return:
|
|
94
|
+
"""
|
|
95
|
+
if not start_date:
|
|
96
|
+
start_date = lazytime.get_date_string(days=0)
|
|
97
|
+
if not end_date:
|
|
98
|
+
end_date = lazytime.get_date_string(days=0)
|
|
99
|
+
url = "https://cli2.mobgi.com/ReportV23/AdReport/getReport"
|
|
100
|
+
data = {
|
|
101
|
+
"start_date": start_date,
|
|
102
|
+
"end_date": end_date,
|
|
103
|
+
"page": page,
|
|
104
|
+
"page_size": page_size,
|
|
105
|
+
"media_type": media_type,
|
|
106
|
+
"time_dim": time_dim,
|
|
107
|
+
"data_type": data_type,
|
|
108
|
+
"data_dim": data_dim,
|
|
109
|
+
"sort_field": sort_field,
|
|
110
|
+
"sort_direction": sort_direction,
|
|
111
|
+
}
|
|
112
|
+
if media_type == "baidu":
|
|
113
|
+
if not conditions:
|
|
114
|
+
conditions = {
|
|
115
|
+
"keyword": "",
|
|
116
|
+
"advertiser_id": [],
|
|
117
|
+
"app_id": [],
|
|
118
|
+
"owner_user_id": [],
|
|
119
|
+
"media_agent_id": []
|
|
120
|
+
}
|
|
121
|
+
if not kpis:
|
|
122
|
+
kpis = [
|
|
123
|
+
"cost",
|
|
124
|
+
"weixinfollowsuccessconversions",
|
|
125
|
+
"weixinfollowsuccessconversionscost",
|
|
126
|
+
"payreaduv",
|
|
127
|
+
"payreaduvcost",
|
|
128
|
+
"cpc"
|
|
129
|
+
]
|
|
130
|
+
if not relate_dims:
|
|
131
|
+
relate_dims = ["advertiser_id"]
|
|
132
|
+
|
|
133
|
+
elif media_type == "gdt_new":
|
|
134
|
+
if not conditions:
|
|
135
|
+
conditions = {
|
|
136
|
+
"keyword": "",
|
|
137
|
+
"advertiser_id": [],
|
|
138
|
+
"app_id": [],
|
|
139
|
+
"owner_user_id": [],
|
|
140
|
+
"media_agent_id": [],
|
|
141
|
+
"landing_type": [],
|
|
142
|
+
"time_line": "REPORTING_TIME"
|
|
143
|
+
}
|
|
144
|
+
if not kpis:
|
|
145
|
+
kpis = [
|
|
146
|
+
"cost",
|
|
147
|
+
"conversions_count",
|
|
148
|
+
"from_follow_uv",
|
|
149
|
+
"cheout_fd",
|
|
150
|
+
"cheout_fd_reward",
|
|
151
|
+
"thousand_display_price",
|
|
152
|
+
"first_pay_count",
|
|
153
|
+
"conversions_cost",
|
|
154
|
+
"from_follow_cost",
|
|
155
|
+
"valid_click_count",
|
|
156
|
+
"cpc"
|
|
157
|
+
]
|
|
158
|
+
if not relate_dims:
|
|
159
|
+
relate_dims = ["advertiser_id"]
|
|
160
|
+
|
|
161
|
+
elif media_type == "toutiao_upgrade":
|
|
162
|
+
if not conditions:
|
|
163
|
+
conditions = {
|
|
164
|
+
"keyword": "",
|
|
165
|
+
"advertiser_id": [],
|
|
166
|
+
"app_id": [],
|
|
167
|
+
"owner_user_id": [],
|
|
168
|
+
"media_agent_id": [],
|
|
169
|
+
"landing_type": [],
|
|
170
|
+
"cl_create_way": []
|
|
171
|
+
}
|
|
172
|
+
if not kpis:
|
|
173
|
+
kpis = [
|
|
174
|
+
"stat_cost",
|
|
175
|
+
"cpm_platform",
|
|
176
|
+
"convert_cnt",
|
|
177
|
+
"conversion_cost",
|
|
178
|
+
"active",
|
|
179
|
+
"active_cost",
|
|
180
|
+
"click_cnt",
|
|
181
|
+
"cpc_platform",
|
|
182
|
+
"attribution_game_in_app_ltv_1day",
|
|
183
|
+
"attribution_game_in_app_roi_1day",
|
|
184
|
+
"ctr"
|
|
185
|
+
]
|
|
186
|
+
if not relate_dims:
|
|
187
|
+
relate_dims = ["advertiser_id"]
|
|
188
|
+
|
|
189
|
+
else:
|
|
190
|
+
showlog.warning("未知媒体类型")
|
|
191
|
+
return
|
|
192
|
+
|
|
193
|
+
headers = copy.deepcopy(default_headers)
|
|
194
|
+
headers["Cookie"] = cookie
|
|
195
|
+
data["conditions"] = conditions
|
|
196
|
+
data["kpis"] = kpis
|
|
197
|
+
data["relate_dims"] = relate_dims
|
|
198
|
+
return lazyrequests.lazy_requests(
|
|
199
|
+
method="POST",
|
|
200
|
+
url=url,
|
|
201
|
+
json=data,
|
|
202
|
+
headers=headers
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def get_plan_list(
|
|
207
|
+
cookie: str,
|
|
208
|
+
media_type: str,
|
|
209
|
+
media_account_id: int,
|
|
210
|
+
sort_field: str,
|
|
211
|
+
page: int = 1,
|
|
212
|
+
page_size: int = 20,
|
|
213
|
+
start_date: str = None,
|
|
214
|
+
end_date: str = None,
|
|
215
|
+
sort_direction: str = "desc",
|
|
216
|
+
data_type: str = "list",
|
|
217
|
+
conditions: dict = None,
|
|
218
|
+
advertiser_id: int = None,
|
|
219
|
+
cdt_start_date: str = None,
|
|
220
|
+
cdt_end_date: str = None,
|
|
221
|
+
kpis: list = None
|
|
222
|
+
):
|
|
223
|
+
"""
|
|
224
|
+
获取推广计划
|
|
225
|
+
:param cookie:
|
|
226
|
+
:param media_type:
|
|
227
|
+
:param media_account_id:
|
|
228
|
+
:param sort_field: 排序字段
|
|
229
|
+
:param page:
|
|
230
|
+
:param page_size:
|
|
231
|
+
:param start_date: 数据开始日期
|
|
232
|
+
:param end_date: 数据结束日期
|
|
233
|
+
:param sort_direction: 排序方式,desc:降序
|
|
234
|
+
:param data_type:
|
|
235
|
+
:param conditions: 搜索条件
|
|
236
|
+
:param advertiser_id: 账户id
|
|
237
|
+
:param cdt_start_date: 创建开始时间
|
|
238
|
+
:param cdt_end_date: 创建结束时间
|
|
239
|
+
:param kpis:
|
|
240
|
+
:return:
|
|
241
|
+
"""
|
|
242
|
+
if not start_date:
|
|
243
|
+
start_date = lazytime.get_date_string(days=0)
|
|
244
|
+
if not end_date:
|
|
245
|
+
end_date = lazytime.get_date_string(days=0)
|
|
246
|
+
if not cdt_start_date:
|
|
247
|
+
cdt_start_date = lazytime.get_date_string(days=-365)
|
|
248
|
+
if not cdt_end_date:
|
|
249
|
+
cdt_end_date = {lazytime.get_date_string(days=0)}
|
|
250
|
+
data = {
|
|
251
|
+
"start_date": start_date,
|
|
252
|
+
"end_date": end_date,
|
|
253
|
+
"page": page,
|
|
254
|
+
"page_size": page_size,
|
|
255
|
+
"sort_field": sort_field,
|
|
256
|
+
"sort_direction": sort_direction,
|
|
257
|
+
"data_type": data_type
|
|
258
|
+
}
|
|
259
|
+
if media_type == "baidu":
|
|
260
|
+
url = "https://cli2.mobgi.com/Baidu/Campaign/getList"
|
|
261
|
+
if not conditions:
|
|
262
|
+
conditions = {
|
|
263
|
+
"cl_project_id": [],
|
|
264
|
+
"optimize_user_id": [],
|
|
265
|
+
"media_account_id": [],
|
|
266
|
+
"extension_subject": [],
|
|
267
|
+
"status": "",
|
|
268
|
+
"keyword": "",
|
|
269
|
+
"companys": [],
|
|
270
|
+
"cdt_start_date": f"{cdt_start_date} 00:00:00",
|
|
271
|
+
"cdt_end_date": f"{cdt_end_date} 23:59:59"
|
|
272
|
+
}
|
|
273
|
+
if media_account_id:
|
|
274
|
+
conditions["media_account_id"] = [media_account_id]
|
|
275
|
+
data["conditions"] = json.dumps(conditions)
|
|
276
|
+
elif media_type == "gdt_new":
|
|
277
|
+
url = "https://cli2.mobgi.com/Gdt/MainList/getList"
|
|
278
|
+
if not conditions:
|
|
279
|
+
conditions = {
|
|
280
|
+
"is_deleted": "",
|
|
281
|
+
"project_id": [],
|
|
282
|
+
"advertiser_id": [],
|
|
283
|
+
"user_id": [],
|
|
284
|
+
"configured_status": [],
|
|
285
|
+
"keyword": "",
|
|
286
|
+
"companys": [],
|
|
287
|
+
"time_line": "REPORTING_TIME",
|
|
288
|
+
"cdt_start_date": f"{cdt_start_date} 00:00:00",
|
|
289
|
+
"cdt_end_date": f"{cdt_end_date} 23:59:59"
|
|
290
|
+
}
|
|
291
|
+
if advertiser_id:
|
|
292
|
+
conditions["advertiser_id"] = [advertiser_id]
|
|
293
|
+
data["conditions"] = json.dumps(conditions)
|
|
294
|
+
if kpis:
|
|
295
|
+
data["kpis"] = kpis
|
|
296
|
+
else:
|
|
297
|
+
return
|
|
298
|
+
headers = copy.deepcopy(default_headers)
|
|
299
|
+
headers["Cookie"] = cookie
|
|
300
|
+
return lazyrequests.lazy_requests(
|
|
301
|
+
method="POST",
|
|
302
|
+
url=url,
|
|
303
|
+
json=data,
|
|
304
|
+
headers=headers
|
|
305
|
+
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
lazyad/__init__.py,sha256=tnVTFEgdzgMWQI0mZqy3DAueMJjpypPb15DdxJ-9TiU,41
|
|
2
2
|
lazyad/crawlers/__init__.py,sha256=GK3GGpiUJbESc1uGTwSmEnsSUwYDNZfJCxeLYB4CpS4,68
|
|
3
|
-
lazyad/crawlers/chuangliang.py,sha256=
|
|
3
|
+
lazyad/crawlers/chuangliang.py,sha256=0JoLIf5sH6vQOCTcECKCtpj9xTPkD7ZJZRmHWLeCo3A,9304
|
|
4
4
|
lazyad/crawlers/oceanengine.py,sha256=kjBEpCb_h5OpodCTqzvXd5MBBwAuw3Oq5UKWoTCXrQM,4540
|
|
5
5
|
lazyad/crawlers/qq.py,sha256=mAVOP1TOGVD1juu77uKBauN7vLymukTJ1mJ8uyRh9a8,3230
|
|
6
6
|
lazyad/open/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
7
7
|
lazyad/open/qq.py,sha256=B6HWnBmtF3mbpwto1wqi7j-auK73Kzp8ESxeUpvLHRA,4391
|
|
8
|
-
lazyad-0.0.
|
|
9
|
-
lazyad-0.0.
|
|
10
|
-
lazyad-0.0.
|
|
11
|
-
lazyad-0.0.
|
|
8
|
+
lazyad-0.0.17.dist-info/METADATA,sha256=lj1QdyGlvUP8Te8xcmMYR2Ye4lXYTKcYZjNTol6ICSo,1695
|
|
9
|
+
lazyad-0.0.17.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
10
|
+
lazyad-0.0.17.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
|
|
11
|
+
lazyad-0.0.17.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|