Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
a297c1a1
Commit
a297c1a1
authored
Aug 13, 2019
by
张彦钊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change test fil
parent
397c99b0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
176 additions
and
2 deletions
+176
-2
feature_bias.py
eda/esmm/Model_pipline/feature_bias.py
+3
-2
hello.py
hello.py
+173
-0
No files found.
eda/esmm/Model_pipline/feature_bias.py
View file @
a297c1a1
...
...
@@ -220,7 +220,7 @@ def feature_engineer():
# TODO 上线后把下面train fliter 删除,因为最近一天的数据也要作为训练集
train
=
rdd
.
filter
(
lambda
x
:
x
[
0
]
!=
validate_date
)
.
map
(
train
=
rdd
.
map
(
lambda
x
:
(
x
[
1
],
x
[
2
],
x
[
3
],
x
[
4
],
x
[
5
],
x
[
6
],
x
[
7
],
x
[
8
],
x
[
9
],
x
[
10
],
x
[
11
]))
f
=
time
.
time
()
...
...
@@ -338,6 +338,7 @@ def get_predict(date,value_map,app_list_map,leve2_map,leve3_map):
print
(
"nearby tfrecord done"
)
else
:
print
(
"预测集nearby为空"
)
rdd
.
unpersist
()
if
__name__
==
'__main__'
:
...
...
@@ -358,6 +359,6 @@ if __name__ == '__main__':
local_path
=
"/home/gmuser/esmm/"
validate_date
,
value_map
,
app_list_map
,
leve2_map
,
leve3_map
=
feature_engineer
()
get_predict
(
validate_date
,
value_map
,
app_list_map
,
leve2_map
,
leve3_map
)
#
get_predict(validate_date, value_map, app_list_map, leve2_map, leve3_map)
spark
.
stop
()
hello.py
0 → 100644
View file @
a297c1a1
import
requests
import
re
import
time
import
random
import
json
import
urllib3
from
lxml
import
etree
from
bs4
import
BeautifulSoup
urllib3
.
disable_warnings
()
device_Android
=
868771031984211
# 868080041007174
# device_IOS = "B6712382-345D-4B12-343C-5F266411C4CK" # 自己本机
device_IOS
=
"E417C286-40A4-42F6-BDA9-AEEBD8FEC3B6"
city
=
"beijing"
# beijing
s
=
requests
.
session
()
def
get_d
(
id
):
url
=
"https://backend.igengmei.com/api/tractate/list?t=1565668444141&version=7.12.6&hybrid=true&channel=App
%20
Store¤t_city_id={}&device_id={}&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=E6937620-F372-434B-9084-9A9580573838&lat=40.00190424107359&lng=116.4871480941339&platform=iPhone&os_version=11.4.1&json=&tractate_id=42124&start_num=0&from=&data_type=user_post"
.
format
(
city
,
device_IOS
,
id
)
a
=
s
.
get
(
url
,
verify
=
False
)
aa
=
a
.
json
()
print
(
"请求id为:
%
s"
%
id
)
return
aa
def
mysql
(
device_Android
):
db
=
pymysql
.
connect
(
host
=
'172.16.30.136'
,
port
=
3306
,
user
=
'doris'
,
passwd
=
'o5gbA27hXHHm'
,
db
=
'doris_prod'
)
sql
=
"select queue from device_user_topic_queue where device_id = '{}'"
.
format
(
device_Android
)
cursor
=
db
.
cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchone
()
db
.
close
()
l
=
result
[
0
]
.
split
(
","
)
print
(
l
)
return
l
def
get_chapter
(
id
):
"""
topic 帖子
wiki 百科
data 回答
special 专题
diary 日记
live 直播
:return:
"""
error
=
''
Jtabtype
=
'choice'
# 精选
Stabtype
=
'home_video'
# 视频
Qtabtype
=
'tab_operate'
# 其他
pre
=
"https://backend.igengmei.com"
prehera
=
"https://hera.igengmei.com"
# Android
J
=
"{}/api/index/v7?offset=&tabtype=choice&tags_id=
%5
B
%5
D&tab_id=0&face_simulator_time=&is_7770_homepage_gray=1&app_name=com.wanmeizhensuo.zhensuo&version=7.8.0&platform=android&device_id={}&os_version=8.1.0&model=V1809T&screen=1080x2340&lat=40.00204&lng=116.487055&channel=benzhan¤t_city_id={}&manufacturer=vivo&uuid=2b15eed5-5361-4a7a-874d-c6a87d5e0a64&android_device_id=androidid_233708112de9a151"
.
format
(
pre
,
device_Android
,
city
)
J2
=
"{}/api/index/v7?offset=A
%3
D5
%26
C
%3
D2
%26
B
%3
D1
%26
E
%3
D1
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D1
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D1&tabtype=choice&tags_id=
%5
B
%5
D&tab_id=0&face_simulator_time=&is_7770_homepage_gray=1&app_name=com.wanmeizhensuo.zhensuo&version=7.8.0&platform=android&device_id={}&os_version=8.1.0&model=V1809T&screen=1080x2340&lat=40.00204&lng=116.487055&channel=benzhan¤t_city_id={}&manufacturer=vivo&uuid=2b15eed5-5361-4a7a-874d-c6a87d5e0a64&android_device_id=androidid_233708112de9a151"
.
format
(
pre
,
device_Android
,
city
)
J3
=
"{}/api/index/v7?offset=A
%3
D11
%26
C
%3
D4
%26
B
%3
D2
%26
E
%3
D2
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D2
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D2&tabtype=choice&tags_id=
%5
B
%5
D&tab_id=0&face_simulator_time=&is_7770_homepage_gray=1&app_name=com.wanmeizhensuo.zhensuo&version=7.8.0&platform=android&device_id={}&os_version=8.1.0&model=V1809T&screen=1080x2340&lat=40.00204&lng=116.487055&channel=benzhan¤t_city_id={}&manufacturer=vivo&uuid=2b15eed5-5361-4a7a-874d-c6a87d5e0a64&android_device_id=androidid_233708112de9a151"
.
format
(
pre
,
device_Android
,
city
)
J4
=
"{}/api/index/v7?offset=A
%3
D19
%26
C
%3
D7
%26
B
%3
D4
%26
E
%3
D3
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D3
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D3&tabtype=choice&tags_id=
%5
B
%5
D&tab_id=0&face_simulator_time=&is_7770_homepage_gray=1&app_name=com.wanmeizhensuo.zhensuo&version=7.8.0&platform=android&device_id={}&os_version=8.1.0&model=V1809T&screen=1080x2340&lat=40.00204&lng=116.487055&channel=benzhan¤t_city_id={}&manufacturer=vivo&uuid=2b15eed5-5361-4a7a-874d-c6a87d5e0a64&android_device_id=androidid_233708112de9a151"
.
format
(
pre
,
device_Android
,
city
)
J5
=
"{}/api/index/v7?offset=A
%3
D19
%26
C
%3
D7
%26
B
%3
D4
%26
E
%3
D3
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D3
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D4&tabtype=choice&tags_id=
%5
B
%5
D&tab_id=0&face_simulator_time=&is_7770_homepage_gray=1&app_name=com.wanmeizhensuo.zhensuo&version=7.8.0&platform=android&device_id={}&os_version=8.1.0&model=V1809T&screen=1080x2340&lat=40.00204&lng=116.487055&channel=benzhan¤t_city_id={}&manufacturer=vivo&uuid=2b15eed5-5361-4a7a-874d-c6a87d5e0a64&android_device_id=androidid_233708112de9a151"
.
format
(
pre
,
device_Android
,
city
)
# IOS
OJ1
=
"{}/api/index/v7?platform=iPhone&os_version=11.4.1&version=7.9.2&model=iPhone
%206
s&release=1&idfa=B6712382-69D5-4B12-9810-5F266411C4CF&idfv=EEF47D5D-0B1D-46C6-AB16-3D3BFC125044&device_id={}&channel=App
%20
Store&app_name=gengmeiios¤t_city_id={}&lat=40.00148597039029&lng=116.484250436819&is_WiFi=1&hardware_model=iPhone8,1&count=10&offset=&tab_id=0&tabtype=choice&tags_id=
%5
B
%5
D"
.
format
(
pre
,
device_IOS
,
city
)
OJ2
=
"{}/api/index/v7?platform=iPhone&os_version=12.0.1&version=7.8.0&model=iPhone
%205
S&release=1&idfa=00000000-0000-0000-0000-000000000000&idfv=1CF209E0-D061-4630-817C-3A7B90AAA1A9&device_id={}&channel=App
%20
Store&app_name=gengmeiios¤t_city_id={}&lat=40.00198608081014&lng=116.4871573600158&is_WiFi=1&hardware_model=iPhone6,2&count=10&offset=A
%3
D5
%26
C
%3
D2
%26
B
%3
D1
%26
E
%3
D1
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D1
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D1&tab_id=0&tabtype=choice&tags_id=
%5
B
%5
D"
.
format
(
pre
,
device_IOS
,
city
)
OJ3
=
"{}/api/index/v7?platform=iPhone&os_version=12.0.1&version=7.8.0&model=iPhone
%205
S&release=1&idfa=00000000-0000-0000-0000-000000000000&idfv=1CF209E0-D061-4630-817C-3A7B90AAA1A9&device_id={}&channel=App
%20
Store&app_name=gengmeiios¤t_city_id={}&lat=40.00198608081014&lng=116.4871573600158&is_WiFi=1&hardware_model=iPhone6,2&count=10&offset=A
%3
D11
%26
C
%3
D4
%26
B
%3
D2
%26
E
%3
D2
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D2
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D2&tab_id=0&tabtype=choice&tags_id=
%5
B
%5
D"
.
format
(
pre
,
device_IOS
,
city
)
OJ4
=
"{}/api/index/v7?platform=iPhone&os_version=12.0.1&version=7.8.0&model=iPhone
%205
S&release=1&idfa=00000000-0000-0000-0000-000000000000&idfv=1CF209E0-D061-4630-817C-3A7B90AAA1A9&device_id={}&channel=App
%20
Store&app_name=gengmeiios¤t_city_id={}&lat=40.00198608081014&lng=116.4871573600158&is_WiFi=1&hardware_model=iPhone6,2&count=10&offset=A
%3
D19
%26
C
%3
D7
%26
B
%3
D4
%26
E
%3
D3
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D3
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D3&tab_id=0&tabtype=choice&tags_id=
%5
B
%5
D"
.
format
(
pre
,
device_IOS
,
city
)
OJ5
=
"{}/api/index/v7?platform=iPhone&os_version=12.0.1&version=7.8.0&model=iPhone
%205
S&release=1&idfa=00000000-0000-0000-0000-000000000000&idfv=1CF209E0-D061-4630-817C-3A7B90AAA1A9&device_id={}&channel=App
%20
Store&app_name=gengmeiios¤t_city_id={}&lat=40.00198608081014&lng=116.4871573600158&is_WiFi=1&hardware_model=iPhone6,2&count=10&offset=A
%3
D19
%26
C
%3
D7
%26
B
%3
D4
%26
E
%3
D3
%26
D
%3
D0
%26
G
%3
D0
%26
F
%3
D0
%26
I
%3
D0
%26
H
%3
D3
%26
K
%3
D0
%26
J
%3
D0
%26
M
%3
D0
%26
L
%3
D0
%26
O
%3
D0
%26
N
%3
D0
%26
Q
%3
D0
%26
P
%3
D0
%26
S
%3
D0
%26
R
%3
D0
%26
U
%3
D0
%26
T
%3
D0
%26
W
%3
D0
%26
V
%3
D0
%26
Y
%3
D0
%26
page
%3
D4&tab_id=0&tabtype=choice&tags_id=
%5
B
%5
D"
.
format
(
pre
,
device_IOS
,
city
)
JX
=
[
OJ1
,
OJ2
,
OJ3
,
OJ4
,
OJ5
]
# JX = [J, J2, J3, J4, J5]
# JX_Text = ["Android 精选第一页", "Android 精选第二页", "Android 精选第三页", "Android 精选第四页", "Android 精选第五页"]
JX_Text
=
[
"IOS 精选第一页"
,
"IOS 精选第二页"
,
"IOS 精选第三页"
,
"IOS 精选第四页"
,
"IOS 精选第五页"
]
for
i
in
range
(
len
(
JX
)):
sultAll
=
s
.
get
(
JX
[
i
],
verify
=
False
)
# 精选
data
=
sultAll
.
json
()[
'data'
][
'features'
]
# print(json.dumps(sultAll.json()))
print
(
"
%
s , 数据总数为:
%
s"
%
(
JX_Text
[
i
],
len
(
data
)))
# 精选
dataType
=
[]
dateId
=
[]
tag_id
=
[]
tag_name
=
[]
topic
=
[]
for
i
in
range
(
len
(
data
)):
if
'diary'
in
data
[
i
]:
dataType
.
append
(
'diary'
)
dateId
.
append
(
data
[
i
][
'id'
])
try
:
tag_id
.
append
(
data
[
i
][
'diary'
][
'tags'
][
0
][
'tag_id'
])
tag_name
.
append
(
data
[
i
][
'diary'
][
'tags'
][
0
][
'name'
])
except
:
tag_id
.
append
(
"日记tag为空"
)
tag_name
.
append
(
"日记tag为空"
)
elif
'topic'
in
data
[
i
]:
# print(data[i]['topic'])
dataType
.
append
(
'topic'
)
dateId
.
append
(
data
[
i
][
'id'
])
topic
.
append
(
data
[
i
][
'id'
])
a
=
data
[
i
][
'topic'
][
'tags'
]
# print(a)
try
:
tag_id
.
append
(
a
[
0
][
'tag_id'
])
tag_name
.
append
(
a
[
0
][
'tag_name'
])
except
:
tag_id
.
append
(
"帖子tag为空"
)
tag_name
.
append
(
"帖子tag为空"
)
elif
'wiki'
in
data
[
i
]:
# print(data[i]['wiki'])
dataType
.
append
(
'wiki'
)
dateId
.
append
(
data
[
i
][
'id'
])
tag_id
.
append
(
data
[
i
][
'wiki'
][
'tags'
][
0
][
'tag_id'
])
tag_name
.
append
(
data
[
i
][
'wiki'
][
'tags'
][
0
][
'tag_name'
])
elif
'data'
in
data
[
i
]:
# print(data[i]['data'])
dataType
.
append
(
'data'
)
dateId
.
append
(
data
[
i
][
'id'
])
tag_id
.
append
(
data
[
i
][
'data'
][
'tags'
][
0
][
'tag_id'
])
tag_name
.
append
(
data
[
i
][
'data'
][
'tags'
][
0
][
'tag_name'
])
elif
'live'
in
data
[
i
]:
# print(data[i]['live'])
dataType
.
append
(
'live'
)
dateId
.
append
(
data
[
i
][
'id'
])
tag_id
.
append
(
data
[
i
][
'live'
][
'tags'
][
0
][
'tag_id'
])
tag_name
.
append
(
data
[
i
][
'live'
][
'tags'
][
0
][
'tag_name'
])
elif
'special'
in
data
[
i
]:
# print(data[i]['special'])
dataType
.
append
(
'special'
)
dateId
.
append
(
data
[
i
][
'id'
])
tag_id
.
append
(
data
[
i
][
'special'
][
'tags'
][
0
][
'tag_id'
])
tag_name
.
append
(
data
[
i
][
'special'
][
'tags'
][
0
][
'tag_name'
])
elif
'qa'
in
data
[
i
]:
# print(data[i]['qa'])
dataType
.
append
(
'qa'
)
dateId
.
append
(
data
[
i
][
'id'
])
tag_id
.
append
(
'问答'
)
tag_name
.
append
(
'问答'
)
else
:
# print("异常: %s" % data[i])
dataType
.
append
(
'异常'
)
dateId
.
append
(
'异常'
)
tag_id
.
append
(
'异常'
)
tag_name
.
append
(
'异常'
)
# print(dataType)
print
(
dateId
)
# print(tag_id)
# print(tag_name)
# print(topic)
for
i
in
dateId
:
if
i
==
id
:
print
(
"失败"
)
else
:
pass
if
__name__
==
'__main__'
:
get_d
()
a
=
mysql
(
device_Android
,
city
)
for
i
in
a
:
chapter_list
=
get_chapter
(
i
)
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