|
@@ -12,7 +12,7 @@ class SphNrxs:
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
- def get_sph_data(cls, user):
|
|
|
+ def get_sph_data(cls, user, nick_name, uid):
|
|
|
url = "http://61.48.133.26:30001/FinderGetUpMasterNextPage"
|
|
|
count = 1
|
|
|
headers = {
|
|
@@ -62,30 +62,42 @@ class SphNrxs:
|
|
|
time.sleep(random.randint(0, 1))
|
|
|
video_obj = response.json()
|
|
|
video_url = video_obj.get('DownloadAddress')
|
|
|
- duration = video_obj.get('play_len')
|
|
|
- cover = video_obj.get('thumb_url')
|
|
|
if len(video_url) == 0:
|
|
|
continue
|
|
|
-
|
|
|
+ duration = video_obj.get('play_len')
|
|
|
+ # cover = video_obj.get('thumb_url')
|
|
|
share_cnt = int(obj['forward_count']) # 分享
|
|
|
like_cnt = int(obj['like_count']) # 点赞
|
|
|
- user_name = obj['username'] # 用户名标示
|
|
|
+ # user_name = obj['username'] # 用户名标示
|
|
|
nick_name = obj['nickname'] # 用户名
|
|
|
- comment_count = obj['comment_count'] # 评论数
|
|
|
- fav_count = obj['fav_count'] # 大拇指点赞数
|
|
|
+ # comment_count = obj['comment_count'] # 评论数
|
|
|
+ # fav_count = obj['fav_count'] # 大拇指点赞数
|
|
|
+ values = [
|
|
|
+ [
|
|
|
+ uid,
|
|
|
+ nick_name,
|
|
|
+ like_cnt,
|
|
|
+ share_cnt,
|
|
|
+ duration,
|
|
|
+ video_url
|
|
|
+ ]
|
|
|
+ ]
|
|
|
+ Feishu.insert_columns("UBvisMdE7hkI6rtIfzycCtdsnWM", '3476ab', "ROWS", 1, 2)
|
|
|
+ time.sleep(0.5)
|
|
|
+ Feishu.update_values("UBvisMdE7hkI6rtIfzycCtdsnWM", '3476ab', "A2:Z2", values)
|
|
|
Common.logger("sph_nrxs").info(f"{nick_name}符合规则")
|
|
|
except Exception as e:
|
|
|
Common.logger("sph_nrxs").info(f"{user}异常,异常信息{e}")
|
|
|
return
|
|
|
|
|
|
@classmethod
|
|
|
- def get_nrxs_list(cls):
|
|
|
+ def get_nrxs_list(cls, uid):
|
|
|
list = []
|
|
|
cookie = Material.get_cookie_data("KsoMsyP2ghleM9tzBfmcEEXBnXg", "U1gySe", "视频号加热")
|
|
|
url = "http://8.217.190.241:8888/crawler/wei_xin/shi_pin_hao/jia_re"
|
|
|
|
|
|
payload = json.dumps({
|
|
|
- "account_name": "央视新闻",
|
|
|
+ "account_name": uid,
|
|
|
"category": "推荐",
|
|
|
"cookie": cookie
|
|
|
})
|
|
@@ -93,6 +105,7 @@ class SphNrxs:
|
|
|
'Content-Type': 'application/json'
|
|
|
}
|
|
|
try:
|
|
|
+ time.sleep(2)
|
|
|
response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
response = response.json()
|
|
|
code = response['code']
|
|
@@ -103,7 +116,9 @@ class SphNrxs:
|
|
|
nick_name = data['nickName'] # 用户名
|
|
|
user_name = data['username'] # 用户v2
|
|
|
data_dict = {"nick_name": nick_name, "user_name": user_name}
|
|
|
+ cls.get_sph_data(user_name, nick_name, uid)
|
|
|
list.append(data_dict)
|
|
|
+ return list
|
|
|
else:
|
|
|
Feishu.bot("xinxin", '视频号加热提醒', f'cookie 失效了,请即使更换', 'xinxin')
|
|
|
return None
|
|
@@ -122,9 +137,10 @@ class SphNrxs:
|
|
|
if re.match(r'^[A-Za-z0-9]+$', uid):
|
|
|
# 匹配成功,进行下一次循环
|
|
|
continue
|
|
|
- print(uid)
|
|
|
+ list = cls.get_nrxs_list(uid)
|
|
|
+ print(list)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
- SphNrxs.get_nrxs_list()
|
|
|
+ SphNrxs.sph_nrxs_data()
|