|
@@ -12,18 +12,17 @@ from common.sql_help import sqlCollect
|
|
|
class QplKs:
|
|
|
@classmethod
|
|
|
def ks_star_info(cls):
|
|
|
- # {'美食': '673'}, {'旅游': '679'}, {'音乐': '687'}, {'教育培训': '685'},
|
|
|
- content_type = [{'时政资讯': '692'},
|
|
|
+ content_type = [{'美食': '673'}, {'旅游': '679'}, {'音乐': '687'}, {'教育培训': '685'}, {'时政资讯': '692'},
|
|
|
{'军事': '701'},{'舞蹈': '688'}, {'生活': '677'},
|
|
|
{'母婴亲子': '676'}, {'萌宠': '691'}, {'情感': '696'}, {'搞笑': '695'}, {'人文': '697'},
|
|
|
{'三农': '694'}, {'科学与法律': '693'}, {'读书': '689'}, {'奇人异象': '700'}, {'民生资讯': '703'},
|
|
|
{'纪实类': '705'}, {'财经投资': '690'}, {'摄影': '704'}, {'艺术文化': '682'}, {'房产家居': '683'},
|
|
|
{'时尚': '675'}, {'体育运动': '680'}, {'健身达人': '706'},{'健康医疗': '684'},]
|
|
|
#{'星座命理': '699'}, {'汽车': '678'}, {'影视娱乐': '702'},{'短剧': '674'},{'高新数码': '686'}
|
|
|
- # fans_count = [{10000000: 0}, {5000000: 10000000}, {3000000: 5000000}, {1000000: 3000000}, {100000: 1000000}, {0: 100000}]
|
|
|
+ fans_count = [{10000000: 0}, {5000000: 10000000}, {3000000: 5000000}, {1000000: 3000000}, {100000: 1000000}, {0: 100000}]
|
|
|
# fans_count = [{5000000: 10000000}, {3000000: 5000000}, {1000000: 3000000}, {100000: 1000000}, {0: 100000}]
|
|
|
|
|
|
- fans_count = [{0: 100000}]
|
|
|
+ # fans_count = [{0: 100000}]
|
|
|
|
|
|
|
|
|
|
|
@@ -41,111 +40,116 @@ class QplKs:
|
|
|
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36',
|
|
|
}
|
|
|
for count in fans_count:
|
|
|
- (fans_min_num, fans_max_num), = count.items()
|
|
|
- for content in content_type:
|
|
|
- (content_name, content_id), = content.items()
|
|
|
- current_page = 1
|
|
|
- while True:
|
|
|
- payload_data = {
|
|
|
- "currentPage": current_page,
|
|
|
- "pageSize": 20,
|
|
|
- "starOrderTag":22,
|
|
|
- "taskType": 1,
|
|
|
- "marketingGoal": 1,
|
|
|
- "viewerAgeList": [ # 观众画像 50+
|
|
|
- {
|
|
|
- "from": "0.50",
|
|
|
- "to": "1.00",
|
|
|
- "queryName": "50+"
|
|
|
- }
|
|
|
- ],
|
|
|
- "userName": "",
|
|
|
- "vitalityTags": [ # 活跃度 近期短视频活跃
|
|
|
- "668"
|
|
|
- ],
|
|
|
- "contentTagIdList": [ # 内容类型
|
|
|
- {
|
|
|
- "id": str(content_id),
|
|
|
- "selectFirstLevelId": True
|
|
|
- }
|
|
|
- ],
|
|
|
- # "starTagIds": [ # 高调性
|
|
|
- # 13
|
|
|
- # ],
|
|
|
- "fansMinNum": fans_min_num, # 粉丝数量
|
|
|
- "fansMaxNum": fans_max_num, # 粉丝数量
|
|
|
- }
|
|
|
- if fans_min_num > 0:
|
|
|
- payload_data["fansMinNum"] = fans_min_num
|
|
|
- if fans_max_num > 0:
|
|
|
- payload_data["fansMaxNum"] = fans_max_num
|
|
|
- payload = json.dumps(payload_data)
|
|
|
+ try:
|
|
|
+
|
|
|
+ (fans_min_num, fans_max_num), = count.items()
|
|
|
+ for content in content_type:
|
|
|
+ (content_name, content_id), = content.items()
|
|
|
+ current_page = 1
|
|
|
+ while True:
|
|
|
+ payload_data = {
|
|
|
+ "currentPage": current_page,
|
|
|
+ "pageSize": 20,
|
|
|
+ "starOrderTag":22,
|
|
|
+ "taskType": 1,
|
|
|
+ "marketingGoal": 1,
|
|
|
+ "viewerAgeList": [ # 观众画像 50+
|
|
|
+ {
|
|
|
+ "from": "0.50",
|
|
|
+ "to": "1.00",
|
|
|
+ "queryName": "50+"
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ "userName": "",
|
|
|
+ "vitalityTags": [ # 活跃度 近期短视频活跃
|
|
|
+ "668"
|
|
|
+ ],
|
|
|
+ "contentTagIdList": [ # 内容类型
|
|
|
+ {
|
|
|
+ "id": str(content_id),
|
|
|
+ "selectFirstLevelId": True
|
|
|
+ }
|
|
|
+ ],
|
|
|
+ # "starTagIds": [ # 高调性
|
|
|
+ # 13
|
|
|
+ # ],
|
|
|
+ "fansMinNum": fans_min_num, # 粉丝数量
|
|
|
+ "fansMaxNum": fans_max_num, # 粉丝数量
|
|
|
+ }
|
|
|
+ if fans_min_num > 0:
|
|
|
+ payload_data["fansMinNum"] = fans_min_num
|
|
|
+ if fans_max_num > 0:
|
|
|
+ payload_data["fansMaxNum"] = fans_max_num
|
|
|
+ payload = json.dumps(payload_data)
|
|
|
|
|
|
- time.sleep(random.randint(1, 5))
|
|
|
- response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
- if ": 109" in response.text:
|
|
|
- text = (
|
|
|
- f"**通知类型**: 磁力聚星cookie过期\n"
|
|
|
- f"**链接**: https://w42nne6hzg.feishu.cn/sheets/B3LFsemLuhyJPktxIoMcJM6znSh?sheet=c95862\n"
|
|
|
- )
|
|
|
- Feishu.finish_bot(text,
|
|
|
- "https://open.feishu.cn/open-apis/bot/v2/hook/ba69e1b6-5839-4640-8932-94f53de5a067",
|
|
|
- "【 磁力聚星cookie过期 】")
|
|
|
- time.sleep(360)
|
|
|
- continue
|
|
|
- response = response.json()
|
|
|
- print(f"开始扫描{content},粉丝量{payload_data['fansMinNum']}~{payload_data['fansMaxNum']}")
|
|
|
- try:
|
|
|
- result = response["result"]
|
|
|
- if result == 1:
|
|
|
- total = response["total"] # 总条数
|
|
|
- if total == 0:
|
|
|
- print(f"没有扫描到数据{content}")
|
|
|
- break
|
|
|
- star_list = response["starList"]
|
|
|
- if len(star_list) == 0 or star_list == []:
|
|
|
- break
|
|
|
- for star in star_list:
|
|
|
- print(f"扫描到一条数据{content}")
|
|
|
- user_id = star["userId"]
|
|
|
- star_id = star["starId"]
|
|
|
- name = star["name"] # 用户名
|
|
|
- kwai_id = star["kwaiId"] # 用户名id
|
|
|
- gender = star["gender"] # 性别
|
|
|
- fans_number = star["fansNumber"] # 粉丝数
|
|
|
- profile_id = star["profileId"] # 主页id
|
|
|
+ time.sleep(random.randint(1, 5))
|
|
|
+ response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
+ if ": 109" in response.text:
|
|
|
+ text = (
|
|
|
+ f"**通知类型**: 磁力聚星cookie过期\n"
|
|
|
+ f"**链接**: https://w42nne6hzg.feishu.cn/sheets/B3LFsemLuhyJPktxIoMcJM6znSh?sheet=c95862\n"
|
|
|
+ )
|
|
|
+ Feishu.finish_bot(text,
|
|
|
+ "https://open.feishu.cn/open-apis/bot/v2/hook/ba69e1b6-5839-4640-8932-94f53de5a067",
|
|
|
+ "【 磁力聚星cookie过期 】")
|
|
|
+ time.sleep(360)
|
|
|
+ continue
|
|
|
+ response = response.json()
|
|
|
+ print(f"开始扫描{content},粉丝量{payload_data['fansMinNum']}~{payload_data['fansMaxNum']}")
|
|
|
+ try:
|
|
|
+ result = response["result"]
|
|
|
+ if result == 1:
|
|
|
+ total = response["total"] # 总条数
|
|
|
+ if total == 0:
|
|
|
+ print(f"没有扫描到数据{content}")
|
|
|
+ break
|
|
|
+ star_list = response["starList"]
|
|
|
+ if len(star_list) == 0 or star_list == []:
|
|
|
+ break
|
|
|
+ for star in star_list:
|
|
|
+ print(f"扫描到一条数据{content}")
|
|
|
+ user_id = star["userId"]
|
|
|
+ star_id = star["starId"]
|
|
|
+ name = star["name"] # 用户名
|
|
|
+ kwai_id = star["kwaiId"] # 用户名id
|
|
|
+ gender = star["gender"] # 性别
|
|
|
+ fans_number = star["fansNumber"] # 粉丝数
|
|
|
+ profile_id = star["profileId"] # 主页id
|
|
|
+ id = sqlCollect.select_ks_star_data(profile_id)
|
|
|
+ if id:
|
|
|
+ print(
|
|
|
+ f"重复视频{profile_id},{content},粉丝量{payload_data['fansMinNum']}~{payload_data['fansMaxNum']}")
|
|
|
+ continue
|
|
|
+ star_tag_str = star["starTagStr"] # 内容类型1
|
|
|
+ industry_tag_str = star["industryTagStr"] # 内容类型2
|
|
|
+ photo_expect_play = star["photoExpectPlay"] # 预期播放量
|
|
|
+ photo_expect_cpm = star["photoExpectCpm"] # 预期CPM
|
|
|
+ photo_interaction_rate = star["photoInteractionRate"] # 互动率
|
|
|
+ photo_complete_play_rate = star["photoCompletePlayRate"] # 完播率
|
|
|
+ fans_increase_num = star["fansIncreaseNum"] # 粉丝增长量
|
|
|
+ fans_increase_rate = star["fansIncreaseRate"] # 粉丝增长率
|
|
|
+ sqlCollect.insert_ks_star_data(user_id, star_id, name, kwai_id, gender, fans_number, profile_id, star_tag_str, industry_tag_str, photo_expect_play, photo_expect_cpm, photo_interaction_rate, photo_complete_play_rate, fans_increase_num, fans_increase_rate)
|
|
|
+ print(f"{star_id}-{profile_id}获取列表入库成功")
|
|
|
+ cls.ks_star_works_info(star_id, profile_id, cookie)
|
|
|
+ time.sleep(random.randint(1, 5))
|
|
|
+ cls.ks_list_portrait_info(star_id, profile_id, cookie)
|
|
|
+ time.sleep(random.randint(1, 5))
|
|
|
+ current_page += 1
|
|
|
+ if total < 20:
|
|
|
+ break
|
|
|
+ else:
|
|
|
+ page = int(total)/20
|
|
|
+ if current_page > int(page)+1:
|
|
|
+ break
|
|
|
id = sqlCollect.select_ks_star_data(profile_id)
|
|
|
if id:
|
|
|
- print(
|
|
|
- f"重复视频{profile_id},{content},粉丝量{payload_data['fansMinNum']}~{payload_data['fansMaxNum']}")
|
|
|
- continue
|
|
|
- star_tag_str = star["starTagStr"] # 内容类型1
|
|
|
- industry_tag_str = star["industryTagStr"] # 内容类型2
|
|
|
- photo_expect_play = star["photoExpectPlay"] # 预期播放量
|
|
|
- photo_expect_cpm = star["photoExpectCpm"] # 预期CPM
|
|
|
- photo_interaction_rate = star["photoInteractionRate"] # 互动率
|
|
|
- photo_complete_play_rate = star["photoCompletePlayRate"] # 完播率
|
|
|
- fans_increase_num = star["fansIncreaseNum"] # 粉丝增长量
|
|
|
- fans_increase_rate = star["fansIncreaseRate"] # 粉丝增长率
|
|
|
- sqlCollect.insert_ks_star_data(user_id, star_id, name, kwai_id, gender, fans_number, profile_id, star_tag_str, industry_tag_str, photo_expect_play, photo_expect_cpm, photo_interaction_rate, photo_complete_play_rate, fans_increase_num, fans_increase_rate)
|
|
|
- print(f"{star_id}-{profile_id}获取列表入库成功")
|
|
|
- cls.ks_star_works_info(star_id, profile_id, cookie)
|
|
|
- time.sleep(random.randint(1, 5))
|
|
|
- cls.ks_list_portrait_info(star_id, profile_id, cookie)
|
|
|
- time.sleep(random.randint(1, 5))
|
|
|
- current_page += 1
|
|
|
- if total < 20:
|
|
|
- break
|
|
|
- else:
|
|
|
- page = int(total)/20
|
|
|
- if current_page > int(page)+1:
|
|
|
break
|
|
|
- id = sqlCollect.select_ks_star_data(profile_id)
|
|
|
- if id:
|
|
|
- break
|
|
|
- except Exception as e:
|
|
|
- print(f"{e}")
|
|
|
- continue
|
|
|
+ except Exception as e:
|
|
|
+ print(f"{e}")
|
|
|
+ continue
|
|
|
+ except Exception as e:
|
|
|
+ print(f"{e}")
|
|
|
+ continue
|
|
|
|
|
|
"""
|
|
|
传播表现
|