lazyad 0.0.14__py3-none-any.whl → 0.0.16__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 +161 -13
- lazyad/crawlers/qq.py +9 -4
- {lazyad-0.0.14.dist-info → lazyad-0.0.16.dist-info}/METADATA +1 -1
- {lazyad-0.0.14.dist-info → lazyad-0.0.16.dist-info}/RECORD +6 -6
- {lazyad-0.0.14.dist-info → lazyad-0.0.16.dist-info}/WHEEL +0 -0
- {lazyad-0.0.14.dist-info → lazyad-0.0.16.dist-info}/top_level.txt +0 -0
lazyad/crawlers/chuangliang.py
CHANGED
|
@@ -1,20 +1,23 @@
|
|
|
1
1
|
from lazysdk import lazyrequests
|
|
2
|
+
from lazysdk import lazytime
|
|
3
|
+
import showlog
|
|
2
4
|
import copy
|
|
3
5
|
|
|
6
|
+
|
|
4
7
|
default_headers = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
"Accept": "application/json, text/plain, */*",
|
|
9
|
+
"Accept-Encoding": "gzip, deflate",
|
|
10
|
+
"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",
|
|
11
|
+
"Connection": "keep-alive",
|
|
12
|
+
"Host": "cli2.mobgi.com",
|
|
13
|
+
"Origin": "https://cl.mobgi.com",
|
|
14
|
+
"Referer": "https://cl.mobgi.com/",
|
|
15
|
+
"Sec-Fetch-Dest": "empty",
|
|
16
|
+
"Sec-Fetch-Mode": "cors",
|
|
17
|
+
"Sec-Fetch-Site": "same-site",
|
|
18
|
+
"TE": "trailers",
|
|
19
|
+
"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:105.0) Gecko/20100101 Firefox/105.0",
|
|
20
|
+
}
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
def get_media_account(
|
|
@@ -52,3 +55,148 @@ def get_media_account(
|
|
|
52
55
|
headers=headers,
|
|
53
56
|
return_json=True
|
|
54
57
|
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def get_ad_report(
|
|
61
|
+
cookie: str,
|
|
62
|
+
start_date: str = None,
|
|
63
|
+
end_date: str = None,
|
|
64
|
+
page: int = 1,
|
|
65
|
+
page_size: int = 20,
|
|
66
|
+
media_type: str = "gdt_new",
|
|
67
|
+
sort_field: str = "cost",
|
|
68
|
+
time_dim: str = "sum",
|
|
69
|
+
sort_direction: str = "desc",
|
|
70
|
+
data_dim: str = "ad",
|
|
71
|
+
data_type: str = "list",
|
|
72
|
+
conditions: dict = None,
|
|
73
|
+
kpis: list = None,
|
|
74
|
+
relate_dims: list = None,
|
|
75
|
+
):
|
|
76
|
+
"""
|
|
77
|
+
报表-广告报表
|
|
78
|
+
:param cookie:
|
|
79
|
+
:param start_date: 数据开始日期,默认为当日
|
|
80
|
+
:param end_date: 数据结束日期,默认为当日
|
|
81
|
+
:param page: 页码
|
|
82
|
+
:param page_size: 每页数量
|
|
83
|
+
:param media_type: 媒体:gdt_new|广点通(新指标体系),toutiao_upgrade|今日头条2.0,aggregate|不限
|
|
84
|
+
:param sort_field: 排序字段
|
|
85
|
+
:param time_dim: 数据的时间维度汇总方式
|
|
86
|
+
:param sort_direction: 排序方式,desc降序
|
|
87
|
+
:param data_dim: 数据维度,ad广告,advertiser_id:账户
|
|
88
|
+
:param data_type:
|
|
89
|
+
:param conditions: 搜索条件
|
|
90
|
+
:param kpis: 需要获取的字段
|
|
91
|
+
:param relate_dims: 关联维度,advertiser_id:账户
|
|
92
|
+
:return:
|
|
93
|
+
"""
|
|
94
|
+
if not start_date:
|
|
95
|
+
start_date = lazytime.get_date_string(days=0)
|
|
96
|
+
if not end_date:
|
|
97
|
+
end_date = lazytime.get_date_string(days=0)
|
|
98
|
+
url = "https://cli2.mobgi.com/ReportV23/AdReport/getReport"
|
|
99
|
+
data = {
|
|
100
|
+
"start_date": start_date,
|
|
101
|
+
"end_date": end_date,
|
|
102
|
+
"page": page,
|
|
103
|
+
"page_size": page_size,
|
|
104
|
+
"media_type": media_type,
|
|
105
|
+
"time_dim": time_dim,
|
|
106
|
+
"data_type": data_type,
|
|
107
|
+
"data_dim": data_dim,
|
|
108
|
+
"sort_field": sort_field,
|
|
109
|
+
"sort_direction": sort_direction,
|
|
110
|
+
}
|
|
111
|
+
if media_type == "baidu":
|
|
112
|
+
if not conditions:
|
|
113
|
+
conditions = {
|
|
114
|
+
"keyword": "",
|
|
115
|
+
"advertiser_id": [],
|
|
116
|
+
"app_id": [],
|
|
117
|
+
"owner_user_id": [],
|
|
118
|
+
"media_agent_id": []
|
|
119
|
+
}
|
|
120
|
+
if not kpis:
|
|
121
|
+
kpis = [
|
|
122
|
+
"cost",
|
|
123
|
+
"weixinfollowsuccessconversions",
|
|
124
|
+
"weixinfollowsuccessconversionscost",
|
|
125
|
+
"payreaduv",
|
|
126
|
+
"payreaduvcost",
|
|
127
|
+
"cpc"
|
|
128
|
+
]
|
|
129
|
+
if not relate_dims:
|
|
130
|
+
relate_dims = ["advertiser_id"]
|
|
131
|
+
|
|
132
|
+
elif media_type == "gdt_new":
|
|
133
|
+
if not conditions:
|
|
134
|
+
conditions = {
|
|
135
|
+
"keyword": "",
|
|
136
|
+
"advertiser_id": [],
|
|
137
|
+
"app_id": [],
|
|
138
|
+
"owner_user_id": [],
|
|
139
|
+
"media_agent_id": [],
|
|
140
|
+
"landing_type": [],
|
|
141
|
+
"time_line": "REPORTING_TIME"
|
|
142
|
+
}
|
|
143
|
+
if not kpis:
|
|
144
|
+
kpis = [
|
|
145
|
+
"cost",
|
|
146
|
+
"conversions_count",
|
|
147
|
+
"from_follow_uv",
|
|
148
|
+
"cheout_fd",
|
|
149
|
+
"cheout_fd_reward",
|
|
150
|
+
"thousand_display_price",
|
|
151
|
+
"first_pay_count",
|
|
152
|
+
"conversions_cost",
|
|
153
|
+
"from_follow_cost",
|
|
154
|
+
"valid_click_count",
|
|
155
|
+
"cpc"
|
|
156
|
+
]
|
|
157
|
+
if not relate_dims:
|
|
158
|
+
relate_dims = ["advertiser_id"]
|
|
159
|
+
|
|
160
|
+
elif media_type == "toutiao_upgrade":
|
|
161
|
+
if not conditions:
|
|
162
|
+
conditions = {
|
|
163
|
+
"keyword": "",
|
|
164
|
+
"advertiser_id": [],
|
|
165
|
+
"app_id": [],
|
|
166
|
+
"owner_user_id": [],
|
|
167
|
+
"media_agent_id": [],
|
|
168
|
+
"landing_type": [],
|
|
169
|
+
"cl_create_way": []
|
|
170
|
+
}
|
|
171
|
+
if not kpis:
|
|
172
|
+
kpis = [
|
|
173
|
+
"stat_cost",
|
|
174
|
+
"cpm_platform",
|
|
175
|
+
"convert_cnt",
|
|
176
|
+
"conversion_cost",
|
|
177
|
+
"active",
|
|
178
|
+
"active_cost",
|
|
179
|
+
"click_cnt",
|
|
180
|
+
"cpc_platform",
|
|
181
|
+
"attribution_game_in_app_ltv_1day",
|
|
182
|
+
"attribution_game_in_app_roi_1day",
|
|
183
|
+
"ctr"
|
|
184
|
+
]
|
|
185
|
+
if not relate_dims:
|
|
186
|
+
relate_dims = ["advertiser_id"]
|
|
187
|
+
|
|
188
|
+
else:
|
|
189
|
+
showlog.warning("未知媒体类型")
|
|
190
|
+
return
|
|
191
|
+
|
|
192
|
+
headers = copy.deepcopy(default_headers)
|
|
193
|
+
headers["Cookie"] = cookie
|
|
194
|
+
data["conditions"] = conditions
|
|
195
|
+
data["kpis"] = kpis
|
|
196
|
+
data["relate_dims"] = relate_dims
|
|
197
|
+
return lazyrequests.lazy_requests(
|
|
198
|
+
method="POST",
|
|
199
|
+
url=url,
|
|
200
|
+
json=data,
|
|
201
|
+
headers=headers
|
|
202
|
+
)
|
lazyad/crawlers/qq.py
CHANGED
|
@@ -30,7 +30,10 @@ def new_account_list(
|
|
|
30
30
|
page: int = 1,
|
|
31
31
|
page_size: int = 20,
|
|
32
32
|
account_id: int = None, # 支持按户id搜索
|
|
33
|
-
account_status: int = 1
|
|
33
|
+
account_status: int = 1,
|
|
34
|
+
sort_seq: str = None,
|
|
35
|
+
sort_field: str = None,
|
|
36
|
+
platform_type: int = 1
|
|
34
37
|
):
|
|
35
38
|
"""
|
|
36
39
|
概览-账户 页面按照消耗降序排序的数据
|
|
@@ -60,8 +63,6 @@ def new_account_list(
|
|
|
60
63
|
data = {
|
|
61
64
|
"new_source": 1,
|
|
62
65
|
"user_id": user_id,
|
|
63
|
-
"sort_seq": "desc", # 降序排序,会自动过滤0数据
|
|
64
|
-
"sort_field": "cost", # 按照消耗排序
|
|
65
66
|
"page": page,
|
|
66
67
|
"page_size": page_size,
|
|
67
68
|
"need_sync": True,
|
|
@@ -81,12 +82,16 @@ def new_account_list(
|
|
|
81
82
|
"start_date_millons": lazytime.get_date2timestamp(date=start_date) * 1000, # 开始时间的时间戳
|
|
82
83
|
"end_date_millons": lazytime.get_date2timestamp(date=end_date) * 1000, # 结束时间的时间戳
|
|
83
84
|
"account_status": account_status,
|
|
84
|
-
"platform_type":
|
|
85
|
+
"platform_type": platform_type,
|
|
85
86
|
"use_top_sort": True,
|
|
86
87
|
"filter_empty_data": 0
|
|
87
88
|
}
|
|
88
89
|
if account_id:
|
|
89
90
|
data["account_id"] = [account_id]
|
|
91
|
+
if sort_seq:
|
|
92
|
+
data["sort_seq"] = sort_seq # desc:降序排序,会自动过滤0数据
|
|
93
|
+
if sort_field:
|
|
94
|
+
data["sort_field"] = sort_field # cost:按照消耗排序
|
|
90
95
|
return lazyrequests.lazy_requests(
|
|
91
96
|
method="POST",
|
|
92
97
|
url=url,
|
|
@@ -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=mJ7YZp6EwQDvof4OTNixUBeyzF23h4BG1I6XoldWiCQ,6048
|
|
4
4
|
lazyad/crawlers/oceanengine.py,sha256=kjBEpCb_h5OpodCTqzvXd5MBBwAuw3Oq5UKWoTCXrQM,4540
|
|
5
|
-
lazyad/crawlers/qq.py,sha256=
|
|
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.16.dist-info/METADATA,sha256=pMRO95vhAi2brhxuVLoMLQOo846KxMCXqq9SpcZI0FU,1695
|
|
9
|
+
lazyad-0.0.16.dist-info/WHEEL,sha256=yQN5g4mg4AybRjkgi-9yy4iQEFibGQmlz78Pik5Or-A,92
|
|
10
|
+
lazyad-0.0.16.dist-info/top_level.txt,sha256=RAPjtj4gZYpsKAM3fAQrWyyn84xjdRuaiUS76gx6eNs,7
|
|
11
|
+
lazyad-0.0.16.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|