recommend_kuaishou.py 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2023/2/24
  4. import os
  5. import random
  6. import shutil
  7. import sys
  8. import time
  9. import string
  10. from hashlib import md5
  11. import requests
  12. import json
  13. import urllib3
  14. from requests.adapters import HTTPAdapter
  15. sys.path.append(os.getcwd())
  16. from common.common import Common
  17. from common.feishu import Feishu
  18. from common.getuser import getUser
  19. from common.db import MysqlHelper
  20. from common.publish import Publish
  21. from common.public import get_user_from_mysql, random_title, get_config_from_mysql
  22. from common.userAgent import get_random_user_agent
  23. class KuaiShouRecommend:
  24. platform = "快手"
  25. tag = "快手爬虫,推荐爬虫策略"
  26. @classmethod
  27. def get_rule(cls, log_type, crawler):
  28. try:
  29. rule_sheet = Feishu.get_values_batch(log_type, crawler, "NQ6CZN")
  30. rule_dict = {
  31. "play_cnt": f"{rule_sheet[0][1]}{rule_sheet[0][2]}",
  32. "video_width": f"{rule_sheet[1][1]}{rule_sheet[1][2]}",
  33. "video_height": f"{rule_sheet[2][1]}{rule_sheet[2][2]}",
  34. "like_cnt": f"{rule_sheet[5][1]}{rule_sheet[5][2]}",
  35. "duration": f"{rule_sheet[3][1]}{rule_sheet[3][2]}",
  36. "publish_time": f"{rule_sheet[4][1]}{rule_sheet[4][2]}",
  37. }
  38. return rule_dict
  39. except Exception as e:
  40. Common.logger(log_type, crawler).error(f"get_rule:{e}\n")
  41. @classmethod
  42. def download_rule(cls, video_dict, rule_dict):
  43. if eval(f"{video_dict['video_width']}{rule_dict['video_width']}") is True \
  44. and eval(f"{video_dict['play_cnt']}{rule_dict['play_cnt']}") is True \
  45. and eval(f"{video_dict['video_height']}{rule_dict['video_height']}") is True \
  46. and eval(f"{video_dict['like_cnt']}{rule_dict['like_cnt']}") is True \
  47. and eval(f"{video_dict['duration']}{rule_dict['duration']}") is True \
  48. and eval(f"{video_dict['publish_time']}{rule_dict['publish_time']}") is True:
  49. return True
  50. else:
  51. return False
  52. # 过滤词库
  53. @classmethod
  54. def filter_words(cls, log_type, crawler):
  55. try:
  56. while True:
  57. filter_words_sheet = Feishu.get_values_batch(log_type, crawler, 'HIKVvs')
  58. if filter_words_sheet is None:
  59. Common.logger(log_type, crawler).warning(f"filter_words_sheet:{filter_words_sheet} 10秒钟后重试")
  60. continue
  61. filter_words_list = []
  62. for x in filter_words_sheet:
  63. for y in x:
  64. if y is None:
  65. pass
  66. else:
  67. filter_words_list.append(y)
  68. return filter_words_list
  69. except Exception as e:
  70. Common.logger(log_type, crawler).error(f'filter_words异常:{e}\n')
  71. # 获取用户信息列表
  72. @classmethod
  73. def get_user_list(cls, log_type, crawler, sheetid, env, machine):
  74. try:
  75. while True:
  76. user_sheet = Feishu.get_values_batch(log_type, crawler, sheetid)
  77. if user_sheet is None:
  78. Common.logger(log_type, crawler).warning(f"user_sheet:{user_sheet} 10秒钟后重试")
  79. continue
  80. our_user_list = []
  81. for i in range(1, len(user_sheet)):
  82. # for i in range(1, 2):
  83. out_uid = user_sheet[i][2]
  84. user_name = user_sheet[i][3]
  85. our_uid = user_sheet[i][6]
  86. our_user_link = user_sheet[i][7]
  87. if out_uid is None or user_name is None:
  88. Common.logger(log_type, crawler).info("空行\n")
  89. else:
  90. Common.logger(log_type, crawler).info(f"正在更新 {user_name} 用户信息\n")
  91. if our_uid is None:
  92. out_user_info = cls.get_out_user_info(log_type, crawler, out_uid)
  93. out_user_dict = {
  94. "out_uid": out_uid,
  95. "user_name": user_name,
  96. "out_avatar_url": out_user_info["out_avatar_url"],
  97. "out_create_time": '',
  98. "out_tag": '',
  99. "out_play_cnt": 0,
  100. "out_fans": out_user_info["out_fans"],
  101. "out_follow": out_user_info["out_follow"],
  102. "out_friend": 0,
  103. "out_like": 0,
  104. "platform": cls.platform,
  105. "tag": cls.tag,
  106. }
  107. our_user_dict = getUser.create_user(log_type=log_type, crawler=crawler,
  108. out_user_dict=out_user_dict, env=env, machine=machine)
  109. our_uid = our_user_dict['our_uid']
  110. our_user_link = our_user_dict['our_user_link']
  111. Feishu.update_values(log_type, crawler, sheetid, f'G{i + 1}:H{i + 1}',
  112. [[our_uid, our_user_link]])
  113. Common.logger(log_type, crawler).info(f'站内用户信息写入飞书成功!\n')
  114. our_user_list.append(our_user_dict)
  115. else:
  116. our_user_dict = {
  117. 'out_uid': out_uid,
  118. 'user_name': user_name,
  119. 'our_uid': our_uid,
  120. 'our_user_link': our_user_link,
  121. }
  122. our_user_list.append(our_user_dict)
  123. return our_user_list
  124. except Exception as e:
  125. Common.logger(log_type, crawler).error(f'get_user_list:{e}\n')
  126. # 处理视频标题
  127. @classmethod
  128. def video_title(cls, log_type, crawler, env, title):
  129. title_split1 = title.split(" #")
  130. if title_split1[0] != "":
  131. title1 = title_split1[0]
  132. else:
  133. title1 = title_split1[-1]
  134. title_split2 = title1.split(" #")
  135. if title_split2[0] != "":
  136. title2 = title_split2[0]
  137. else:
  138. title2 = title_split2[-1]
  139. title_split3 = title2.split("@")
  140. if title_split3[0] != "":
  141. title3 = title_split3[0]
  142. else:
  143. title3 = title_split3[-1]
  144. video_title = title3.strip().replace("\n", "") \
  145. .replace("/", "").replace("快手", "").replace(" ", "") \
  146. .replace(" ", "").replace("&NBSP", "").replace("\r", "") \
  147. .replace("#", "").replace(".", "。").replace("\\", "") \
  148. .replace(":", "").replace("*", "").replace("?", "") \
  149. .replace("?", "").replace('"', "").replace("<", "") \
  150. .replace(">", "").replace("|", "").replace("@", "").replace('"', '').replace("'", '')[:40]
  151. if video_title.replace(" ", "") == "" or video_title == "。。。" or video_title == "...":
  152. return random_title(log_type, crawler, env, text='title')
  153. else:
  154. return video_title
  155. @classmethod
  156. def get_videoList(cls, log_type, crawler, strategy, our_uid, oss_endpoint, env, machine):
  157. rule_dict_1 = cls.get_rule(log_type, crawler)
  158. if rule_dict_1 is None:
  159. Common.logger(log_type, crawler).warning(f"rule_dict is None")
  160. return
  161. for i in range(100):
  162. url = "https://www.kuaishou.com/graphql"
  163. payload = json.dumps({
  164. "operationName": "visionNewRecoFeed",
  165. "variables": {
  166. "dailyFirstPage": False
  167. },
  168. "query": "fragment photoContent on PhotoEntity {\n id\n duration\n caption\n originCaption\n likeCount\n viewCount\n realLikeCount\n coverUrl\n photoUrl\n photoH265Url\n manifest\n manifestH265\n videoResource\n coverUrls {\n url\n __typename\n }\n timestamp\n expTag\n animatedCoverUrl\n distance\n videoRatio\n liked\n stereoType\n profileUserTopPhoto\n musicBlocked\n __typename\n}\n\nfragment feedContent on Feed {\n type\n author {\n id\n name\n headerUrl\n following\n headerUrls {\n url\n __typename\n }\n __typename\n }\n photo {\n ...photoContent\n __typename\n }\n canAddComment\n llsid\n status\n currentPcursor\n tags {\n type\n name\n __typename\n }\n __typename\n}\n\nfragment photoResult on PhotoResult {\n result\n llsid\n expTag\n serverExpTag\n pcursor\n feeds {\n ...feedContent\n __typename\n }\n webPageArea\n __typename\n}\n\nquery visionNewRecoFeed($semKeyword: String, $semCrowd: String, $utmSource: String, $utmMedium: String, $utmCampaign: String, $dailyFirstPage: Boolean) {\n visionNewRecoFeed(semKeyword: $semKeyword, semCrowd: $semCrowd, utmSource: $utmSource, utmMedium: $utmMedium, utmCampaign: $utmCampaign, dailyFirstPage: $dailyFirstPage) {\n ...photoResult\n __typename\n }\n}\n"
  169. })
  170. s = string.ascii_lowercase
  171. r = random.choice(s)
  172. headers = {
  173. 'Accept-Language': 'zh-CN,zh;q=0.9',
  174. 'Connection': 'keep-alive',
  175. 'Cookie': 'kpf=PC_WEB; clientid=3; did=web_7cdc486ebd1aba220455a7781d6ae5b5{r}7; kpn=KUAISHOU_VISION;'.format(
  176. r=r),
  177. 'Origin': 'https://www.kuaishou.com',
  178. 'Referer': 'https://www.kuaishou.com/new-reco',
  179. 'Sec-Fetch-Dest': 'empty',
  180. 'Sec-Fetch-Mode': 'cors',
  181. 'Sec-Fetch-Site': 'same-origin',
  182. 'User-Agent': get_random_user_agent('pc'),
  183. 'accept': '*/*',
  184. 'content-type': 'application/json',
  185. 'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',
  186. 'sec-ch-ua-mobile': '?0',
  187. 'sec-ch-ua-platform': '"macOS"'
  188. }
  189. try:
  190. urllib3.disable_warnings()
  191. s = requests.session()
  192. # max_retries=3 重试3次
  193. s.mount('http://', HTTPAdapter(max_retries=3))
  194. s.mount('https://', HTTPAdapter(max_retries=3))
  195. response = s.post(url=url, headers=headers, data=payload, proxies=Common.tunnel_proxies(), verify=False,
  196. timeout=10)
  197. response.close()
  198. except Exception as e:
  199. Common.logger(log_type, crawler).error(f"get_videoList:{e}\n")
  200. continue
  201. # Common.logger(log_type, crawler).info(f"get_videoList:{response.text}\n")
  202. if response.status_code != 200:
  203. Common.logger(log_type, crawler).warning(f"get_videoList_response:{response.text}\n")
  204. continue
  205. elif 'data' not in response.json():
  206. Common.logger(log_type, crawler).warning(f"get_videoList_response:{response.json()}\n")
  207. continue
  208. elif 'visionNewRecoFeed' not in response.json()['data']:
  209. Common.logger(log_type, crawler).warning(f"get_videoList_response:{response.json()['data']}\n")
  210. continue
  211. elif 'feeds' not in response.json()['data']['visionNewRecoFeed']:
  212. Common.logger(log_type, crawler).warning(
  213. f"get_videoList_response:{response.json()['data']['visionNewRecoFeed']}\n")
  214. continue
  215. elif len(response.json()['data']['visionNewRecoFeed']['feeds']) == 0:
  216. Common.logger(log_type, crawler).info("没有更多视频啦 ~\n")
  217. continue
  218. else:
  219. feeds = response.json()['data']['visionNewRecoFeed']['feeds']
  220. for i in range(len(feeds)):
  221. if 'photo' not in feeds[i]:
  222. Common.logger(log_type, crawler).warning(f"get_videoList:{feeds[i]}\n")
  223. continue
  224. # video_title
  225. if 'caption' not in feeds[i]['photo']:
  226. video_title = random_title(log_type, crawler, env, text='title')
  227. elif feeds[i]['photo']['caption'].strip() == "":
  228. video_title = random_title(log_type, crawler, env, text='title')
  229. else:
  230. video_title = cls.video_title(log_type, crawler, env, feeds[i]['photo']['caption'])
  231. if 'videoResource' not in feeds[i]['photo'] \
  232. and 'manifest' not in feeds[i]['photo'] \
  233. and 'manifestH265' not in feeds[i]['photo']:
  234. Common.logger(log_type, crawler).warning(f"get_videoList:{feeds[i]['photo']}\n")
  235. continue
  236. videoResource = feeds[i]['photo']['videoResource']
  237. if 'h264' not in videoResource and 'hevc' not in videoResource:
  238. Common.logger(log_type, crawler).warning(f"get_videoList:{videoResource}\n")
  239. continue
  240. # video_id
  241. if 'h264' in videoResource and 'videoId' in videoResource['h264']:
  242. video_id = videoResource['h264']['videoId']
  243. elif 'hevc' in videoResource and 'videoId' in videoResource['hevc']:
  244. video_id = videoResource['hevc']['videoId']
  245. else:
  246. video_id = ""
  247. # play_cnt
  248. if 'viewCount' not in feeds[i]['photo']:
  249. play_cnt = 0
  250. else:
  251. play_cnt = int(feeds[i]['photo']['viewCount'])
  252. # like_cnt
  253. if 'realLikeCount' not in feeds[i]['photo']:
  254. like_cnt = 0
  255. else:
  256. like_cnt = feeds[i]['photo']['realLikeCount']
  257. # publish_time
  258. if 'timestamp' not in feeds[i]['photo']:
  259. publish_time_stamp = 0
  260. publish_time_str = ''
  261. publish_time = 0
  262. else:
  263. publish_time_stamp = int(int(feeds[i]['photo']['timestamp']) / 1000)
  264. publish_time_str = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(publish_time_stamp))
  265. publish_time = int((int(time.time()) - publish_time_stamp) / (3600 * 24))
  266. # duration
  267. if 'duration' not in feeds[i]['photo']:
  268. duration = 0
  269. else:
  270. duration = int(int(feeds[i]['photo']['duration']) / 1000)
  271. # video_width / video_height / video_url
  272. mapping = {}
  273. for item in ['width', 'height']:
  274. try:
  275. val = str(videoResource['h264']['adaptationSet'][0]['representation'][0][item])
  276. except Exception:
  277. val = str(videoResource['hevc']['adaptationSet'][0]['representation'][0][item])
  278. except:
  279. val = ''
  280. mapping[item] = val
  281. video_width = int(mapping['width']) if mapping['width'] != '' else 0
  282. video_height = int(mapping['height']) if mapping['height'] != '' else 0
  283. # cover_url
  284. if 'coverUrl' not in feeds[i]['photo']:
  285. cover_url = ""
  286. else:
  287. cover_url = feeds[i]['photo']['coverUrl']
  288. # user_name / avatar_url
  289. try:
  290. user_name = feeds[i]['author']['name']
  291. avatar_url = feeds[i]['author']['headerUrl']
  292. user_id = feeds[i]['author']['id']
  293. except Exception:
  294. user_name = ''
  295. avatar_url = ''
  296. user_id = ''
  297. video_url = feeds[i]['photo']['photoUrl']
  298. video_dict = {'video_title': video_title,
  299. 'video_id': video_id,
  300. 'play_cnt': play_cnt,
  301. 'comment_cnt': 0,
  302. 'like_cnt': like_cnt,
  303. 'share_cnt': 0,
  304. 'video_width': video_width,
  305. 'video_height': video_height,
  306. 'duration': duration,
  307. 'publish_time': publish_time,
  308. 'publish_time_stamp': publish_time_stamp,
  309. 'publish_time_str': publish_time_str,
  310. 'user_name': user_name,
  311. 'user_id': user_id,
  312. 'avatar_url': avatar_url,
  313. 'cover_url': cover_url,
  314. 'video_url': video_url,
  315. 'session': f"kuaishou{int(time.time())}"}
  316. rule_1 = cls.download_rule(video_dict, rule_dict_1)
  317. Common.logger(log_type, crawler).info(f"video_title:{video_title}")
  318. Common.logger(log_type, crawler).info(f"video_id:{video_id}\n")
  319. Common.logger(log_type, crawler).info(
  320. f"play_cnt:{video_dict['play_cnt']}{rule_dict_1['play_cnt']}, {eval(str(video_dict['play_cnt']) + str(rule_dict_1['play_cnt']))}")
  321. Common.logger(log_type, crawler).info(
  322. f"like_cnt:{video_dict['like_cnt']}{rule_dict_1['like_cnt']}, {eval(str(video_dict['like_cnt']) + str(rule_dict_1['like_cnt']))}")
  323. Common.logger(log_type, crawler).info(
  324. f"video_width:{video_dict['video_width']}{rule_dict_1['video_width']}, {eval(str(video_dict['video_width']) + str(rule_dict_1['video_width']))}")
  325. Common.logger(log_type, crawler).info(
  326. f"video_height:{video_dict['video_height']}{rule_dict_1['video_height']}, {eval(str(video_dict['video_height']) + str(rule_dict_1['video_height']))}")
  327. Common.logger(log_type, crawler).info(
  328. f"duration:{video_dict['duration']}{rule_dict_1['duration']}, {eval(str(video_dict['duration']) + str(rule_dict_1['duration']))}")
  329. Common.logger(log_type, crawler).info(
  330. f"publish_time:{video_dict['publish_time']}{rule_dict_1['publish_time']}, {eval(str(video_dict['publish_time']) + str(rule_dict_1['publish_time']))}")
  331. Common.logger(log_type, crawler).info(f"rule_1:{rule_1}\n")
  332. if video_title == "" or video_url == "":
  333. Common.logger(log_type, crawler).info("无效视频\n")
  334. continue
  335. elif rule_1 is True:
  336. cls.download_publish(log_type=log_type,
  337. crawler=crawler,
  338. strategy=strategy,
  339. video_dict=video_dict,
  340. rule_dict=rule_dict_1,
  341. our_uid=our_uid,
  342. oss_endpoint=oss_endpoint,
  343. env=env,
  344. machine=machine)
  345. else:
  346. Common.logger(log_type, crawler).info("不满足下载规则\n")
  347. @classmethod
  348. def repeat_video(cls, log_type, crawler, video_id, video_title, publish_time, env, machine):
  349. sql = f""" select * from crawler_video where platform="{cls.platform}" and out_video_id="{video_id}" or (platform="{cls.platform}" and video_title="{video_title}" and publish_time="{publish_time}") """
  350. repeat_video = MysqlHelper.get_values(log_type, crawler, sql, env, machine)
  351. return len(repeat_video)
  352. @classmethod
  353. def download_publish(cls, log_type, crawler, strategy, video_dict, rule_dict, our_uid, oss_endpoint, env, machine):
  354. try:
  355. filter_words = get_config_from_mysql(log_type, crawler, env, text='filter')
  356. for filter_word in filter_words:
  357. if filter_word in video_dict['video_title']:
  358. Common.logger(log_type, crawler).info('标题已中过滤词:{}\n', video_dict['video_title'])
  359. return
  360. download_finished = False
  361. if cls.repeat_video(log_type, crawler, video_dict['video_id'], video_dict['video_title'],
  362. video_dict['publish_time_str'], env, machine) != 0:
  363. Common.logger(log_type, crawler).info('视频已下载\n')
  364. else:
  365. # 下载视频
  366. Common.download_method(log_type=log_type, crawler=crawler, text='video',
  367. title=video_dict['video_title'], url=video_dict['video_url'])
  368. md_title = md5(video_dict['video_title'].encode('utf8')).hexdigest()
  369. if os.path.getsize(f"./{crawler}/videos/{md_title}/video.mp4") == 0:
  370. # 删除视频文件夹
  371. shutil.rmtree(f"./{crawler}/videos/{md_title}")
  372. Common.logger(log_type, crawler).info("视频size=0,删除成功\n")
  373. return
  374. # 下载封面
  375. Common.download_method(log_type=log_type, crawler=crawler, text='cover',
  376. title=video_dict['video_title'], url=video_dict['cover_url'])
  377. # 保存视频信息至txt
  378. Common.save_video_info(log_type=log_type, crawler=crawler, video_dict=video_dict)
  379. # 上传视频
  380. Common.logger(log_type, crawler).info("开始上传视频...")
  381. our_video_id = Publish.upload_and_publish(log_type=log_type,
  382. crawler=crawler,
  383. strategy=strategy,
  384. our_uid=our_uid,
  385. env=env,
  386. oss_endpoint=oss_endpoint)
  387. if env == 'dev':
  388. our_video_link = f"https://testadmin.piaoquantv.com/cms/post-detail/{our_video_id}/info"
  389. else:
  390. our_video_link = f"https://admin.piaoquantv.com/cms/post-detail/{our_video_id}/info"
  391. Common.logger(log_type, crawler).info("视频上传完成")
  392. if our_video_id is None:
  393. Common.logger(log_type, crawler).warning(f"our_video_id:{our_video_id} 删除该视频文件夹")
  394. # 删除视频文件夹
  395. shutil.rmtree(f"./{crawler}/videos/{video_dict['video_title']}")
  396. return download_finished
  397. # 视频信息保存数据库
  398. insert_sql = f""" insert into crawler_video(video_id,
  399. user_id,
  400. out_user_id,
  401. platform,
  402. strategy,
  403. out_video_id,
  404. video_title,
  405. cover_url,
  406. video_url,
  407. duration,
  408. publish_time,
  409. play_cnt,
  410. crawler_rule,
  411. width,
  412. height)
  413. values({our_video_id},
  414. {our_uid},
  415. "{video_dict['user_id']}",
  416. "{cls.platform}",
  417. "{strategy}",
  418. "{video_dict['video_id']}",
  419. "{video_dict['video_title']}",
  420. "{video_dict['cover_url']}",
  421. "{video_dict['video_url']}",
  422. {int(video_dict['duration'])},
  423. "{video_dict['publish_time_str']}",
  424. {int(video_dict['play_cnt'])},
  425. '{json.dumps(rule_dict)}',
  426. {int(video_dict['video_width'])},
  427. {int(video_dict['video_height'])}) """
  428. Common.logger(log_type, crawler).info(f"insert_sql:{insert_sql}")
  429. MysqlHelper.update_values(log_type, crawler, insert_sql, env, machine)
  430. Common.logger(log_type, crawler).info('视频信息插入数据库成功!\n')
  431. # 视频写入飞书
  432. Feishu.insert_columns(log_type, 'kuaishou', "Aps2BI", "ROWS", 1, 2)
  433. upload_time = int(time.time())
  434. values = [[our_video_id,
  435. time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(upload_time)),
  436. strategy,
  437. str(video_dict['video_id']),
  438. video_dict['video_title'],
  439. our_video_link,
  440. video_dict['play_cnt'],
  441. video_dict['comment_cnt'],
  442. video_dict['like_cnt'],
  443. video_dict['share_cnt'],
  444. video_dict['duration'],
  445. f"{video_dict['video_width']}*{video_dict['video_height']}",
  446. video_dict['publish_time_str'],
  447. video_dict['user_name'],
  448. video_dict['user_id'],
  449. video_dict['avatar_url'],
  450. video_dict['cover_url'],
  451. video_dict['video_url']]]
  452. time.sleep(1)
  453. Feishu.update_values(log_type, 'kuaishou', "Aps2BI", "E2:Z2", values)
  454. Common.logger(log_type, crawler).info(f"视频已保存至云文档\n")
  455. download_finished = True
  456. return download_finished
  457. except Exception as e:
  458. Common.logger(log_type, crawler).error(f"download_publish:{e}\n")
  459. if __name__ == "__main__":
  460. KuaiShouRecommend.get_videoList('recommend', 'kuaishou', '推荐抓取策略', 55440319, 'outer', 'prod', 'aliyun')