xiaoniangao_hour_list.py 87 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484
  1. # -*- coding: utf-8 -*-
  2. # @Author: wangkun
  3. # @Time: 2022/5/16
  4. import datetime
  5. import os
  6. import random
  7. import sys
  8. import time
  9. import requests
  10. import urllib3
  11. sys.path.append(os.getcwd())
  12. from main.common import Common
  13. from main.feishu_lib import Feishu
  14. from main.xiaoniangao_publish import Publish
  15. proxies = {"http": None, "https": None}
  16. class HourList:
  17. # 配置微信
  18. time.sleep(1)
  19. wechat_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "dzcWHw")
  20. hour_x_b3_traceid = wechat_sheet[2][1]
  21. hour_x_token_id = wechat_sheet[3][1]
  22. hour_referer = wechat_sheet[4][1]
  23. hour_uid = wechat_sheet[5][1]
  24. hour_token = wechat_sheet[6][1]
  25. # 生成 uid、token
  26. @classmethod
  27. def get_uid_token(cls):
  28. uid_token = "abcdefghijklmnopqrstuvwxyz0123456789"
  29. uid = ("".join(random.sample(uid_token, 8))) + "-" + ("".join(random.sample(uid_token, 4))) + "-" + (
  30. "".join(random.sample(uid_token, 4))) + "-" + ("".join(random.sample(uid_token, 4))) + "-" + (
  31. "".join(random.sample(uid_token, 12)))
  32. token = ("".join(random.sample(uid_token, 32)))
  33. Feishu.update_values("hour", "xiaoniangao", "dzcWHw", "B6:B6", [[uid]])
  34. time.sleep(1)
  35. Feishu.update_values("hour", "xiaoniangao", "dzcWHw", "B7:B7", [[token]])
  36. Common.logger("hour").info("生成 uid:{}, token:{},写入飞书成功\n", uid, token)
  37. # 过滤敏感词
  38. @classmethod
  39. def sensitive_words(cls, log_type):
  40. # 敏感词库列表
  41. word_list = []
  42. # 从云文档读取所有敏感词,添加到词库列表
  43. time.sleep(1)
  44. lists = Feishu.get_values_batch(log_type, "xiaoniangao", "DRAnZh")
  45. for i in lists:
  46. for j in i:
  47. # 过滤空的单元格内容
  48. if j is None:
  49. pass
  50. else:
  51. word_list.append(j)
  52. return word_list
  53. # 视频ID过滤字母
  54. @classmethod
  55. def sensitive_videoid_words(cls):
  56. # 字母列表
  57. words_list = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s",
  58. "t", "u", "v", "w", "x", "y", "z",
  59. "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
  60. "T", "U", "V", "W", "X", "Y", "Z"]
  61. return words_list
  62. # 基础门槛规则
  63. @staticmethod
  64. def download_rule(d_duration, d_width, d_height, d_play_cnt, d_like_cnt, d_share_cnt, d_send_time):
  65. """
  66. 下载视频的基本规则
  67. :param d_duration: 时长
  68. :param d_width: 宽
  69. :param d_height: 高
  70. :param d_play_cnt: 播放量
  71. :param d_like_cnt: 点赞量
  72. :param d_share_cnt: 分享量
  73. :param d_send_time: 发布时间
  74. :return: 满足规则,返回 True;反之,返回 False
  75. """
  76. # 视频时长
  77. if int(float(d_duration)) >= 40:
  78. # 宽或高
  79. if int(d_width) >= 0 or int(d_height) >= 0:
  80. # 播放量
  81. if int(d_play_cnt) >= 4000:
  82. # 点赞量
  83. if int(d_like_cnt) >= 0:
  84. # 分享量
  85. if int(d_share_cnt) >= 0:
  86. # 发布时间 <= 10 天
  87. if int(time.time()) - int(d_send_time) / 1000 <= 864000:
  88. return True
  89. else:
  90. return False
  91. else:
  92. return False
  93. else:
  94. return False
  95. else:
  96. return False
  97. return False
  98. return False
  99. # 检查是否有今日的上升榜日期
  100. @classmethod
  101. def check_hour_list_data(cls, log_type, date):
  102. # 判断J1单元格的日期是否为今天
  103. time.sleep(1)
  104. if Feishu.get_range_value(log_type, "xiaoniangao", "ba0da4", "L1:L1")[0] != date:
  105. # 插入3列 L1:N1,并写入日期和时间数据
  106. values = [[date], ["10:00", "15:00", "20:00"]]
  107. time.sleep(1)
  108. Feishu.insert_columns(log_type, "xiaoniangao", "ba0da4", "COLUMNS", 11, 14)
  109. time.sleep(1)
  110. Feishu.update_values(log_type, "xiaoniangao", "ba0da4", "L1:N2", values)
  111. time.sleep(1)
  112. Feishu.merge_cells(log_type, "xiaoniangao", "ba0da4", "L1:N1")
  113. Common.logger(log_type).info("插入今天日期成功")
  114. else:
  115. Common.logger(log_type).info("今日上升榜日期已存在")
  116. # 获取表情及符号
  117. @classmethod
  118. def get_expression(cls):
  119. expression_list = []
  120. char_list = []
  121. char_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "BhlbST")
  122. for i in range(len(char_sheet)):
  123. if char_sheet[i][0] is not None:
  124. expression_list.append(char_sheet[i][0])
  125. if char_sheet[i][1] is not None:
  126. char_list.append(char_sheet[i][1])
  127. # print(f"expression_list:{expression_list}")
  128. # print(f"char_list:{char_list}")
  129. return expression_list, char_list
  130. # 获取列表
  131. @classmethod
  132. def get_hour_list_feeds(cls, log_type):
  133. """
  134. 1.从列表获取视频,7 天内,播放量>=5000
  135. 2.时长 1-10min
  136. 3.每天10:00、15:00、20:00 把符合规则的视频,写入云文档
  137. https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=ba0da4
  138. """
  139. url = "https://kapi.xiaoniangao.cn/trends/get_recommend_trends"
  140. headers = {
  141. "x-b3-traceid": cls.hour_x_b3_traceid,
  142. "X-Token-Id": cls.hour_x_token_id,
  143. "uid": cls.hour_uid,
  144. "content-type": "application/json",
  145. "Accept-Encoding": "gzip,compress,br,deflate",
  146. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  147. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  148. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  149. "Referer": cls.hour_referer
  150. }
  151. data = {
  152. "log_params": {
  153. "page": "discover_rec",
  154. "common": {
  155. "brand": "iPhone",
  156. "device": "iPhone 11",
  157. "os": "iOS 14.7.1",
  158. "weixinver": "8.0.20",
  159. "srcver": "2.24.2",
  160. "net": "wifi",
  161. "scene": 1089
  162. }
  163. },
  164. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/!750x500r/crop/750x500/interlace/1/format/jpg",
  165. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail/!80x80r/crop/80x80/interlace/1/format/jpg",
  166. "share_width": 625,
  167. "share_height": 500,
  168. "ext": {
  169. "fmid": 0,
  170. "items": {}
  171. },
  172. "app": "xng",
  173. "rec_scene": "discover_rec",
  174. "log_common_params": {
  175. "e": [{
  176. "data": {
  177. "page": "discoverIndexPage",
  178. "topic": "recommend"
  179. },
  180. "ab": {}
  181. }],
  182. "ext": {
  183. "brand": "iPhone",
  184. "device": "iPhone 11",
  185. "os": "iOS 14.7.1",
  186. "weixinver": "8.0.20",
  187. "srcver": "2.24.3",
  188. "net": "wifi",
  189. "scene": "1089"
  190. },
  191. "pj": "1",
  192. "pf": "2",
  193. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  194. },
  195. "refresh": False,
  196. "token": cls.hour_token,
  197. "uid": cls.hour_uid,
  198. "proj": "ma",
  199. "wx_ver": "8.0.20",
  200. "code_ver": "3.62.0"
  201. }
  202. try:
  203. urllib3.disable_warnings()
  204. r = requests.post(url=url, headers=headers, json=data, proxies=proxies, verify=False)
  205. if "data" not in r.json():
  206. Common.logger(log_type).warning("获取视频feeds错误:{}", r.text)
  207. elif "list" not in r.json()["data"]:
  208. Common.logger(log_type).warning("获取视频feeds无数据,休眠10s:{}", r.json()["data"])
  209. else:
  210. # 视频列表数据
  211. feeds = r.json()["data"]["list"]
  212. for i in range(len(feeds)):
  213. # 标题,表情随机加在片头、片尾,或替代句子中间的标点符号
  214. if "title" in feeds[i]:
  215. befor_video_title = feeds[i]["title"].strip().replace("\n", "") \
  216. .replace("/", "").replace("\r", "").replace("#", "") \
  217. .replace(".", "。").replace("\\", "").replace("&NBSP", "") \
  218. .replace(":", "").replace("*", "").replace("?", "") \
  219. .replace("?", "").replace('"', "").replace("<", "") \
  220. .replace(">", "").replace("|", "").replace(" ", "").replace("#表情", "").replace("#符号", "")
  221. expression = cls.get_expression()
  222. expression_list = expression[0]
  223. char_list = expression[1]
  224. # 随机取一个表情
  225. expression = random.choice(expression_list)
  226. # 生成标题list[表情+title, title+表情]
  227. expression_title_list = [expression + befor_video_title, befor_video_title + expression]
  228. # 从标题list中随机取一个标题
  229. title_list1 = random.choice(expression_title_list)
  230. # 生成标题:原标题+符号
  231. title_list2 = befor_video_title + random.choice(char_list)
  232. # 表情和标题组合,与标题和符号组合,汇总成待使用的标题列表
  233. title_list4 = [title_list2, title_list1]
  234. # 最终标题
  235. video_title = random.choice(title_list4)
  236. else:
  237. video_title = 0
  238. # 视频 ID
  239. if "vid" in feeds[i]:
  240. video_id = feeds[i]["vid"]
  241. else:
  242. video_id = 0
  243. # 播放量
  244. if "play_pv" in feeds[i]:
  245. video_play_cnt = feeds[i]["play_pv"]
  246. else:
  247. video_play_cnt = 0
  248. # 点赞量
  249. if "favor" in feeds[i]:
  250. video_like_cnt = feeds[i]["favor"]["total"]
  251. else:
  252. video_like_cnt = 0
  253. # 分享量
  254. if "share" in feeds[i]:
  255. video_share_cnt = feeds[i]["share"]
  256. else:
  257. video_share_cnt = 0
  258. # 时长
  259. if "du" in feeds[i]:
  260. video_duration = int(feeds[i]["du"] / 1000)
  261. else:
  262. video_duration = 0
  263. # 宽和高
  264. if "w" or "h" in feeds[i]:
  265. video_width = feeds[i]["w"]
  266. video_height = feeds[i]["h"]
  267. else:
  268. video_width = 0
  269. video_height = 0
  270. # 发布时间
  271. if "t" in feeds[i]:
  272. video_send_time = feeds[i]["t"]
  273. else:
  274. video_send_time = 0
  275. # 用户名 / 头像
  276. if "user" in feeds[i]:
  277. user_name = feeds[i]["user"]["nick"].strip().replace("\n", "") \
  278. .replace("/", "").replace("快手", "").replace(" ", "") \
  279. .replace(" ", "").replace("&NBSP", "").replace("\r", "")
  280. head_url = feeds[i]["user"]["hurl"]
  281. else:
  282. user_name = 0
  283. head_url = 0
  284. # 用户 ID
  285. profile_id = feeds[i]["id"]
  286. # 用户 mid
  287. profile_mid = feeds[i]["user"]["mid"]
  288. # 视频封面
  289. if "url" in feeds[i]:
  290. cover_url = feeds[i]["url"]
  291. else:
  292. cover_url = 0
  293. # 视频播放地址
  294. if "v_url" in feeds[i]:
  295. video_url = feeds[i]["v_url"]
  296. else:
  297. video_url = 0
  298. Common.logger(log_type).info("标题:{}", video_title)
  299. Common.logger(log_type).info("视频ID:{}", video_id)
  300. Common.logger(log_type).info("播放量:{}", video_play_cnt)
  301. Common.logger(log_type).info("时长:{}秒", video_duration)
  302. Common.logger(log_type).info(
  303. "视频发布时间:{}", time.strftime(
  304. "%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time) / 1000)))
  305. Common.logger(log_type).info("用户名:{}", user_name)
  306. Common.logger(log_type).info("播放地址:{}", video_url)
  307. # 过滤无效视频
  308. if video_title == 0 or video_id == 0 or video_duration == 0 \
  309. or video_send_time == 0 or user_name == 0 or head_url == 0 \
  310. or cover_url == 0 or video_url == 0:
  311. Common.logger(log_type).warning("无效视频")
  312. # 抓取基础规则过滤
  313. elif cls.download_rule(video_duration, video_width, video_height, video_play_cnt,
  314. video_like_cnt, video_share_cnt, video_send_time) is False:
  315. Common.logger(log_type).info("不满足基础门槛规则")
  316. # 过滤敏感词
  317. elif any(str(word) if str(word) in video_title else False for word in cls.sensitive_words(log_type)) is True:
  318. Common.logger(log_type).info("视频已中敏感词:{}".format(video_title))
  319. time.sleep(1)
  320. # 从云文档中去重: 小时级_已下载表
  321. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
  322. Common.logger(log_type).info("该视频已下载:{}", video_title)
  323. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "InCA1I") for j in i]:
  324. Common.logger(log_type).info("该视频已下载:{}", video_title)
  325. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "66n2um") for j in i]:
  326. Common.logger(log_type).info("该视频已下载:{}", video_title)
  327. # 从云文档中去重: 用户主页_已下载表
  328. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "Wu0CeL") for j in i]:
  329. Common.logger(log_type).info("该视频已下载:{}", video_title)
  330. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "bkIrcr") for j in i]:
  331. Common.logger(log_type).info("该视频已下载:{}", video_title)
  332. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "FcQ4MN") for j in i]:
  333. Common.logger(log_type).info("该视频已下载:{}", video_title)
  334. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "zI9QJz") for j in i]:
  335. Common.logger(log_type).info("该视频已下载:{}", video_title)
  336. # 从云文档去重: 播放量_已下载表
  337. elif video_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "c85k1C") for j in i]:
  338. Common.logger(log_type).info("该视频已下载:{}", video_title)
  339. # 从云文档去重: 小年糕小时级数据_feeds
  340. elif video_id in [j for i in Feishu.get_values_batch("hour", "xiaoniangao", "ba0da4") for j in i]:
  341. Common.logger(log_type).info("该视频已保存过:{}", video_title)
  342. else:
  343. # feeds工作表,插入空行
  344. Feishu.insert_columns(log_type, "xiaoniangao", "ba0da4", "ROWS", 2, 3)
  345. # 获取当前时间
  346. get_feeds_time = int(time.time())
  347. # 看一看云文档,工作表中写入数据
  348. values = [[profile_id,
  349. profile_mid,
  350. video_id,
  351. video_title,
  352. user_name,
  353. video_duration,
  354. cover_url,
  355. video_url,
  356. time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time) / 1000)),
  357. str(time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(get_feeds_time))),
  358. video_play_cnt]]
  359. # 等待 1s,防止操作云文档太频繁,导致报错
  360. time.sleep(0.5)
  361. Feishu.update_values(log_type, "xiaoniangao", "ba0da4", "A3:K3", values)
  362. Common.logger(log_type).info("视频添加至小时级数据_feeds成功:{}\n".format(video_title))
  363. except Exception as e:
  364. Common.logger(log_type).error("获取小时榜视频列表异常:{}\n", e)
  365. # 更新小时榜数据
  366. @classmethod
  367. def update_hour_list_data(cls, log_type, today, yesterday, before_yesterday):
  368. """
  369. 更新小时榜数据
  370. """
  371. try:
  372. update_hour_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "ba0da4")
  373. if len(update_hour_sheet) == 2:
  374. Common.logger(log_type).info("当前工作表无数据")
  375. else:
  376. for i in range(2, len(update_hour_sheet) + 1):
  377. Common.logger(log_type).info("更新第:{}行视频信息", i + 1)
  378. # 略过空行
  379. if update_hour_sheet[i][0] is None \
  380. or update_hour_sheet[i][1] is None or update_hour_sheet[i][2] is None:
  381. Common.logger(log_type).info("空行,略过")
  382. else:
  383. # 视频标题
  384. v_title = update_hour_sheet[i][3]
  385. Common.logger(log_type).info("video_title:{}", v_title)
  386. # 视频 ID
  387. v_id = update_hour_sheet[i][2]
  388. Common.logger(log_type).info("video_id:{}", v_id)
  389. # profile_id,用户 ID
  390. p_id = update_hour_sheet[i][0]
  391. Common.logger(log_type).info("profile_id:{}", p_id)
  392. # profile_mid
  393. p_mid = update_hour_sheet[i][1]
  394. Common.logger(log_type).info("profile_mid:{}", p_mid)
  395. # 抓取时的播放量
  396. v_play_cnt = update_hour_sheet[i][10]
  397. Common.logger(log_type).info("video_play_cnt:{}", v_play_cnt)
  398. # 抓取时间
  399. v_upload_time = update_hour_sheet[i][9]
  400. Common.logger(log_type).info("video_send_time:{}", v_upload_time)
  401. # 抓取时间的时间戳格式(秒为单位)
  402. v_time = int(time.mktime(time.strptime(v_upload_time, "%Y/%m/%d %H:%M:%S")))
  403. # 抓取时间:日期
  404. upload_data = v_upload_time.split(" ")[0]
  405. # 抓取时间:小时
  406. upload_hour = v_upload_time.split(" ")[-1].split(":")[0]
  407. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  408. headers = {
  409. "x-b3-traceid": cls.hour_x_b3_traceid,
  410. "X-Token-Id": cls.hour_x_token_id,
  411. "uid": cls.hour_uid,
  412. "content-type": "application/json",
  413. "Accept-Encoding": "gzip,compress,br,deflate",
  414. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  415. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  416. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  417. "Referer": cls.hour_referer
  418. }
  419. data = {
  420. "play_src": "1",
  421. "profile_id": int(p_id),
  422. "profile_mid": int(p_mid),
  423. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  424. "!400x400r/crop/400x400/interlace/1/format/jpg",
  425. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  426. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  427. "share_width": 625,
  428. "share_height": 500,
  429. "no_comments": True,
  430. "no_follow": True,
  431. "vid": v_id,
  432. "hot_l1_comment": True,
  433. "token": cls.hour_token,
  434. "uid": cls.hour_uid,
  435. "proj": "ma",
  436. "wx_ver": "8.0.20",
  437. "code_ver": "3.62.0",
  438. "log_common_params": {
  439. "e": [{
  440. "data": {
  441. "page": "dynamicSharePage"
  442. }
  443. }],
  444. "ext": {
  445. "brand": "iPhone",
  446. "device": "iPhone 11",
  447. "os": "iOS 14.7.1",
  448. "weixinver": "8.0.20",
  449. "srcver": "2.24.3",
  450. "net": "wifi",
  451. "scene": "1089"
  452. },
  453. "pj": "1",
  454. "pf": "2",
  455. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  456. }
  457. }
  458. try:
  459. urllib3.disable_warnings()
  460. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  461. hour_play_cnt = r.json()["data"]["play_pv"]
  462. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  463. # 固定时间获取符合规则的视频,写入云文档:https://w42nne6hzg.feishu.cn/sheets/shtcngRPoDYAi24x52j2nDuHMih?sheet=ba0da4
  464. update_hour = datetime.datetime.now()
  465. if int(time.time()) - v_time >= 172800:
  466. Common.logger(log_type).info("抓取时间超过 2 天")
  467. return
  468. elif upload_data == today and update_hour.hour == 10 and int(upload_hour) <= 10:
  469. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:10点 and 抓取时间<=10点")
  470. # 当天 10:00 视频播放量
  471. ten_hour_play_cnt = hour_play_cnt
  472. Common.logger(log_type).info("当天 10:00 视频播放量:{}", ten_hour_play_cnt)
  473. # 10:00 的上升榜写入数据
  474. values = int(ten_hour_play_cnt) - int(v_play_cnt)
  475. time.sleep(1)
  476. Feishu.update_values(
  477. log_type, "xiaoniangao", "ba0da4",
  478. "L" + str(i + 1) + ":" + "L" + str(i + 1), [[values]])
  479. Common.logger(log_type).info("10:00数据更新成功:{}", values)
  480. elif upload_data == today and update_hour.hour == 15 and int(upload_hour) <= 10:
  481. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:15点 and 抓取时间<=10点")
  482. # 当天 15:00 视频播放量
  483. fifteen_hour_play_cnt = hour_play_cnt
  484. Common.logger(log_type).info("当天 15:00 视频播放量:{}", fifteen_hour_play_cnt)
  485. # 当天 10:00 上升的数据
  486. if update_hour_sheet[i][11] is None:
  487. ten_up_cnt = 0
  488. else:
  489. ten_up_cnt = update_hour_sheet[i][11]
  490. # 15:00 的上升榜写入数据
  491. values = int(fifteen_hour_play_cnt) - (int(v_play_cnt) + int(ten_up_cnt))
  492. time.sleep(1)
  493. Feishu.update_values(
  494. log_type, "xiaoniangao", "ba0da4",
  495. "M" + str(i + 1) + ":" + "M" + str(i + 1), [[values]])
  496. Common.logger(log_type).info("15:00数据更新成功:{}", values)
  497. elif upload_data == today and update_hour.hour == 15 and 10 < int(upload_hour) <= 15:
  498. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:15点 and 10<抓取时间<=15点")
  499. # 当天 15:00 视频播放量
  500. fifteen_hour_play_cnt = hour_play_cnt
  501. Common.logger(log_type).info("当天 15:00 视频播放量:{}", fifteen_hour_play_cnt)
  502. # 15:00 的上升榜写入数据
  503. values = int(fifteen_hour_play_cnt) - int(v_play_cnt)
  504. time.sleep(1)
  505. Feishu.update_values(
  506. log_type, "xiaoniangao", "ba0da4",
  507. "M" + str(i + 1) + ":" + "M" + str(i + 1), [[values]])
  508. Common.logger(log_type).info("15:00数据更新成功:{}", values)
  509. elif upload_data == today and update_hour.hour == 20 and int(upload_hour) <= 10:
  510. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:20点 and 抓取时间<=10点")
  511. # 当天 20:00 视频播放量
  512. twenty_hour_play_cnt = hour_play_cnt
  513. Common.logger(log_type).info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt)
  514. # 当天 10:00 上升的数据
  515. if update_hour_sheet[i][11] is None:
  516. ten_up_cnt = 0
  517. else:
  518. ten_up_cnt = update_hour_sheet[i][11]
  519. # 当天 15:00 上升的数据
  520. if update_hour_sheet[i][12] is None:
  521. fifteen_up_cnt = 0
  522. else:
  523. fifteen_up_cnt = update_hour_sheet[i][12]
  524. # 20:00 的上升榜写入数据
  525. values = int(twenty_hour_play_cnt) - (
  526. int(v_play_cnt) + int(ten_up_cnt) + int(fifteen_up_cnt))
  527. time.sleep(1)
  528. Feishu.update_values(
  529. log_type, "xiaoniangao", "ba0da4",
  530. "N" + str(i + 1) + ":" + "N" + str(i + 1), [[values]])
  531. Common.logger(log_type).info("20:00数据更新成功:{}", values)
  532. elif upload_data == today and update_hour.hour == 20 and 10 < int(upload_hour) <= 15:
  533. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:20点 and 10<抓取时间<=15点")
  534. # 当天 20:00 视频播放量
  535. twenty_hour_play_cnt = hour_play_cnt
  536. Common.logger(log_type).info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt)
  537. # 当天 15:00 上升的数据
  538. if update_hour_sheet[i][12] is None:
  539. fifteen_up_cnt = 0
  540. else:
  541. fifteen_up_cnt = update_hour_sheet[i][12]
  542. # 20:00 的上升榜写入数据
  543. values = int(twenty_hour_play_cnt) - (int(v_play_cnt) + int(fifteen_up_cnt))
  544. time.sleep(1)
  545. Feishu.update_values(
  546. log_type, "xiaoniangao", "ba0da4",
  547. "N" + str(i + 1) + ":" + "N" + str(i + 1), [[values]])
  548. Common.logger(log_type).info("20:00数据更新成功:{}", values)
  549. elif upload_data == today and update_hour.hour == 20 and 15 < int(upload_hour) <= 20:
  550. Common.logger(log_type).info("满足条件: 抓取日期为今天 and 当前时间:20点 and 15<抓取时间<=20点")
  551. # 当天 20:00 视频播放量
  552. twenty_hour_play_cnt = hour_play_cnt
  553. Common.logger(log_type).info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt)
  554. # 20:00 的上升榜写入数据
  555. values = int(twenty_hour_play_cnt) - int(v_play_cnt)
  556. time.sleep(1)
  557. Feishu.update_values(
  558. log_type, "xiaoniangao", "ba0da4",
  559. "N" + str(i + 1) + ":" + "N" + str(i + 1), [[values]])
  560. Common.logger(log_type).info("20:00数据更新成功:{}", values)
  561. elif (upload_data == yesterday or upload_data == before_yesterday) \
  562. and update_hour.hour == 10:
  563. Common.logger(log_type).info("满足条件: 抓取时间小于今天 and 当前时间:10点")
  564. # 当天 10:00 视频播放量
  565. ten_hour_play_cnt = hour_play_cnt
  566. Common.logger(log_type).info("当天 10:00 视频播放量:{}", ten_hour_play_cnt)
  567. # 10:00 的上升榜写入数据
  568. values = int(ten_hour_play_cnt) - int(v_play_cnt)
  569. time.sleep(1)
  570. Feishu.update_values(
  571. log_type, "xiaoniangao", "ba0da4",
  572. "L" + str(i + 1) + ":" + "L" + str(i + 1), [[values]])
  573. Common.logger(log_type).info("10:00数据更新成功:{}", values)
  574. elif (upload_data == yesterday or upload_data == before_yesterday) \
  575. and update_hour.hour == 15:
  576. Common.logger(log_type).info("满足条件: 抓取时间小于今天 and 当前时间:15点")
  577. # 当天 15:00 视频播放量
  578. fifteen_hour_play_cnt = hour_play_cnt
  579. Common.logger(log_type).info("当天 15:00 视频播放量:{}", fifteen_hour_play_cnt)
  580. # 当天 10:00 上升的数据
  581. if update_hour_sheet[i][11] is None:
  582. ten_up_cnt = 0
  583. else:
  584. ten_up_cnt = update_hour_sheet[i][11]
  585. # 15:00 的上升榜写入数据
  586. values = int(fifteen_hour_play_cnt) - (int(v_play_cnt) + int(ten_up_cnt))
  587. time.sleep(1)
  588. Feishu.update_values(
  589. log_type, "xiaoniangao", "ba0da4",
  590. "M" + str(i + 1) + ":" + "M" + str(i + 1), [[values]])
  591. Common.logger(log_type).info("15:00数据更新成功:{}", values)
  592. elif (upload_data == yesterday or upload_data == before_yesterday) \
  593. and update_hour.hour == 20:
  594. Common.logger(log_type).info("满足条件: 抓取时间小于今天 and 当前时间:20点")
  595. # 当天 20:00 视频播放量
  596. twenty_hour_play_cnt = hour_play_cnt
  597. Common.logger(log_type).info("当天 20:00 视频播放量:{}", twenty_hour_play_cnt)
  598. # 当天 10:00 上升的数据
  599. if update_hour_sheet[i][11] is None:
  600. ten_up_cnt = 0
  601. else:
  602. ten_up_cnt = update_hour_sheet[i][11]
  603. # 当天 15:00 上升的数据
  604. if update_hour_sheet[i][12] is None:
  605. fifteen_up_cnt = 0
  606. else:
  607. fifteen_up_cnt = update_hour_sheet[i][12]
  608. # 20:00 的上升榜写入数据
  609. values = int(twenty_hour_play_cnt) - (
  610. int(v_play_cnt) + int(ten_up_cnt) + int(fifteen_up_cnt))
  611. time.sleep(1)
  612. Feishu.update_values(
  613. log_type, "xiaoniangao", "ba0da4",
  614. "N" + str(i + 1) + ":" + "N" + str(i + 1), [[values]])
  615. Common.logger(log_type).info("20:00数据更新成功:{}", values)
  616. except Exception as e:
  617. Common.logger(log_type).error("视频详情:{},异常:{}", v_title, e)
  618. except Exception as e:
  619. Common.logger(log_type).error("获取小时榜数据异常:{}\n", e)
  620. # 下载/上传
  621. @classmethod
  622. def download_and_publish(cls, log_type):
  623. """
  624. 1.从云文档中去重: https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=yatRv2
  625. 2.从云文档中下载符合规则的视频:https://w42nne6hzg.feishu.cn/sheets/shtcnYxiyQ1wLklo1W5Kdqc9cGh?sheet=ba0da4
  626. 2.1 当日 10:00 or 15:00 or 20:00 视频播放量上升 > 5000
  627. 2.2 当日 10:00 and 15:00 视频播放量上升 > 2000
  628. 2.3 当日 15:00 and 20:00 视频播放量上升 > 2000
  629. 2.4 昨日 20:00 and 今日 10:00 视频播放量上升 > 2000
  630. 3.上传
  631. """
  632. try:
  633. time.sleep(1)
  634. download_hour_sheet = Feishu.get_values_batch("hour", "xiaoniangao", "ba0da4")
  635. if len(download_hour_sheet) == 2:
  636. Common.logger(log_type).info("当前工作表无数据")
  637. else:
  638. for i in range(2, len(download_hour_sheet) + 1):
  639. Common.logger(log_type).info("分析第:{}行视频信息是否符合下载规则", i + 1)
  640. # 略过空行
  641. if download_hour_sheet[i][0] is None \
  642. or download_hour_sheet[i][1] is None or download_hour_sheet[i][2] is None:
  643. Common.logger(log_type).info("空行,略过")
  644. else:
  645. # 今日 10:00 数据上升量
  646. if download_hour_sheet[i][11] is None:
  647. ten_cnt = 0
  648. else:
  649. ten_cnt = download_hour_sheet[i][11]
  650. # 今日 15:00 数据上升量
  651. if download_hour_sheet[i][12] is None:
  652. fifteen_cnt = 0
  653. else:
  654. fifteen_cnt = download_hour_sheet[i][12]
  655. # 今日 20:00 数据上升量
  656. if download_hour_sheet[i][13] is None:
  657. twenty_cnt = 0
  658. else:
  659. twenty_cnt = download_hour_sheet[i][13]
  660. # 昨日 20:00 数据上升量
  661. if download_hour_sheet[i][16] is None:
  662. yesterday_twenty_cnt = 0
  663. else:
  664. yesterday_twenty_cnt = download_hour_sheet[i][16]
  665. # 视频标题
  666. v_title = download_hour_sheet[i][3]
  667. Common.logger(log_type).info("video_title:{}", v_title)
  668. # 视频 ID
  669. v_id = download_hour_sheet[i][2]
  670. Common.logger(log_type).info("video_id:{}", v_id)
  671. # profile_id,用户 ID
  672. p_id = download_hour_sheet[i][0]
  673. # 视频时长
  674. v_duration = download_hour_sheet[i][5]
  675. # profile_mid
  676. p_mid = download_hour_sheet[i][1]
  677. Common.logger(log_type).info("10:00 / 15:00 / 20:00 上升量: {} / {} / {}",
  678. ten_cnt, fifteen_cnt, twenty_cnt)
  679. # 抓取时间
  680. v_upload_time = download_hour_sheet[i][9]
  681. v_send_time = int(time.mktime(time.strptime(v_upload_time, "%Y/%m/%d %H:%M:%S")))
  682. # 播放量
  683. v_play_cnt = download_hour_sheet[i][10]
  684. # # 判断视频 ID 长度,不大于 13 位
  685. # if len(str(v_id)) > 13:
  686. # Common.logger(log_type).info("视频ID长度大于13位:{}", v_id)
  687. #
  688. # el
  689. if int(time.time()) - int(v_send_time) >= 259200:
  690. Common.logger(log_type).info("抓取时间超过 3 天")
  691. return
  692. # 判断视频时长:1-10min
  693. elif int(v_duration) < 40:
  694. Common.logger(log_type).info("视频时长小于 40s")
  695. # # 过滤带字母的视频ID
  696. # elif any(word if word in v_id else False for word in cls.sensitive_videoid_words()) is True:
  697. # Common.logger(log_type).info("视频ID带字母:{}".format(v_id))
  698. # 从云文档中去重: 小时级_已下载表
  699. elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "yatRv2") for j in i]:
  700. Common.logger(log_type).info("该视频已下载:{}", v_title)
  701. elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "InCA1I") for j in i]:
  702. Common.logger(log_type).info("该视频已下载:{}", v_title)
  703. # 从云文档中去重: 用户主页_已下载表
  704. elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "Wu0CeL") for j in i]:
  705. Common.logger(log_type).info("该视频已下载:{}", v_title)
  706. elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "bkIrcr") for j in i]:
  707. Common.logger(log_type).info("该视频已下载:{}", v_title)
  708. # 从云文档中去重: 播放量_已下载表
  709. elif v_id in [j for i in Feishu.get_values_batch(log_type, "xiaoniangao", "c85k1C") for j in i]:
  710. Common.logger(log_type).info("该视频已下载:{}", v_title)
  711. # 播放量大于 50000,直接下载
  712. elif int(v_play_cnt) >= 50000:
  713. Common.logger(log_type).info("播放量:{} >= 50000,满足下载规则,开始下载视频", v_play_cnt)
  714. try:
  715. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  716. headers = {
  717. "x-b3-traceid": cls.hour_x_b3_traceid,
  718. "X-Token-Id": cls.hour_x_token_id,
  719. "uid": cls.hour_uid,
  720. "content-type": "application/json",
  721. "Accept-Encoding": "gzip,compress,br,deflate",
  722. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  723. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  724. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  725. "Referer": cls.hour_referer
  726. }
  727. data = {
  728. "play_src": "1",
  729. "profile_id": int(p_id),
  730. "profile_mid": int(p_mid),
  731. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  732. "!400x400r/crop/400x400/interlace/1/format/jpg",
  733. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  734. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  735. "share_width": 625,
  736. "share_height": 500,
  737. "no_comments": True,
  738. "no_follow": True,
  739. "vid": v_id,
  740. "hot_l1_comment": True,
  741. "token": cls.hour_token,
  742. "uid": cls.hour_uid,
  743. "proj": "ma",
  744. "wx_ver": "8.0.20",
  745. "code_ver": "3.62.0",
  746. "log_common_params": {
  747. "e": [{
  748. "data": {
  749. "page": "dynamicSharePage"
  750. }
  751. }],
  752. "ext": {
  753. "brand": "iPhone",
  754. "device": "iPhone 11",
  755. "os": "iOS 14.7.1",
  756. "weixinver": "8.0.20",
  757. "srcver": "2.24.3",
  758. "net": "wifi",
  759. "scene": "1089"
  760. },
  761. "pj": "1",
  762. "pf": "2",
  763. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  764. }
  765. }
  766. urllib3.disable_warnings()
  767. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  768. hour_play_cnt = r.json()["data"]["play_pv"]
  769. hour_cover_url = r.json()["data"]["url"]
  770. hour_video_url = r.json()["data"]["v_url"]
  771. hour_video_duration = r.json()["data"]["du"]
  772. hour_video_comment_cnt = r.json()["data"]["comment_count"]
  773. hour_video_like_cnt = r.json()["data"]["favor"]["total"]
  774. hour_video_share_cnt = r.json()["data"]["share"]
  775. hour_video_width = r.json()["data"]["w"]
  776. hour_video_height = r.json()["data"]["h"]
  777. hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height)
  778. hour_video_send_time = r.json()["data"]["t"]
  779. hour_user_name = r.json()["data"]["user"]["nick"]
  780. hour_head_url = r.json()["data"]["user"]["hurl"]
  781. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  782. # 下载封面
  783. Common.download_method(log_type, "cover", v_title, hour_cover_url)
  784. # 下载视频
  785. Common.download_method(log_type, "video", v_title, hour_video_url)
  786. # 保存视频信息至 "./videos/{download_video_title}/info.txt"
  787. with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a:
  788. f_a.write(str(v_id) + "\n" +
  789. str(v_title) + "\n" +
  790. str(int(int(hour_video_duration) / 1000)) + "\n" +
  791. str(hour_play_cnt) + "\n" +
  792. str(hour_video_comment_cnt) + "\n" +
  793. str(hour_video_like_cnt) + "\n" +
  794. str(hour_video_share_cnt) + "\n" +
  795. str(hour_video_resolution) + "\n" +
  796. str(hour_video_send_time) + "\n" +
  797. str(hour_user_name) + "\n" +
  798. str(hour_head_url) + "\n" +
  799. str(hour_video_url) + "\n" +
  800. str(hour_cover_url) + "\n" +
  801. str("90747742180aeb22c0fe3a3c6a38f3d9"))
  802. Common.logger(log_type).info("==========视频信息已保存至info.txt==========")
  803. # 上传视频
  804. Common.logger(log_type).info("开始上传视频")
  805. our_video_id = Publish.upload_and_publish(log_type, "prod", "hour")
  806. our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(
  807. our_video_id) + "/info"
  808. Common.logger(log_type).info("视频上传完成:{}", v_title)
  809. # 上传完成时间
  810. upload_time = int(time.time())
  811. # 保存视频信息到云文档
  812. Common.logger(log_type).info("添加视频到云文档:{}", v_title)
  813. # 插入空行
  814. time.sleep(1)
  815. Feishu.insert_columns(log_type, "xiaoniangao", "yatRv2", "ROWS", 1, 2)
  816. # 视频信息写入云文档
  817. values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
  818. "小时级上升榜",
  819. v_id,
  820. v_title,
  821. our_video_link,
  822. hour_play_cnt,
  823. hour_video_comment_cnt,
  824. hour_video_like_cnt,
  825. hour_video_share_cnt,
  826. int(hour_video_duration) / 1000,
  827. hour_video_resolution,
  828. time.strftime("%Y/%m/%d %H:%M:%S",
  829. time.localtime(int(hour_video_send_time) / 1000)),
  830. hour_user_name,
  831. p_id,
  832. p_mid,
  833. hour_head_url,
  834. hour_cover_url,
  835. hour_video_url]]
  836. time.sleep(1)
  837. Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
  838. except Exception as e:
  839. Common.logger(log_type).error("下载视频异常:{}", e)
  840. # 上升榜判断逻辑,任意时间段上升量>=5000,连续两个时间段上升量>=2000
  841. elif int(ten_cnt) >= 5000 or int(fifteen_cnt) >= 5000 or int(twenty_cnt) >= 5000:
  842. Common.logger(log_type).info("10:00 or 15:00 or 20:00 数据上升量:{} or {} or {} >= 5000",
  843. ten_cnt, fifteen_cnt, twenty_cnt)
  844. Common.logger(log_type).info("满足下载规则,开始下载视频")
  845. try:
  846. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  847. headers = {
  848. "x-b3-traceid": cls.hour_x_b3_traceid,
  849. "X-Token-Id": cls.hour_x_token_id,
  850. "uid": cls.hour_uid,
  851. "content-type": "application/json",
  852. "Accept-Encoding": "gzip,compress,br,deflate",
  853. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  854. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  855. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  856. "Referer": cls.hour_referer
  857. }
  858. data = {
  859. "play_src": "1",
  860. "profile_id": int(p_id),
  861. "profile_mid": int(p_mid),
  862. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  863. "!400x400r/crop/400x400/interlace/1/format/jpg",
  864. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  865. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  866. "share_width": 625,
  867. "share_height": 500,
  868. "no_comments": True,
  869. "no_follow": True,
  870. "vid": v_id,
  871. "hot_l1_comment": True,
  872. "token": cls.hour_token,
  873. "uid": cls.hour_uid,
  874. "proj": "ma",
  875. "wx_ver": "8.0.20",
  876. "code_ver": "3.62.0",
  877. "log_common_params": {
  878. "e": [{
  879. "data": {
  880. "page": "dynamicSharePage"
  881. }
  882. }],
  883. "ext": {
  884. "brand": "iPhone",
  885. "device": "iPhone 11",
  886. "os": "iOS 14.7.1",
  887. "weixinver": "8.0.20",
  888. "srcver": "2.24.3",
  889. "net": "wifi",
  890. "scene": "1089"
  891. },
  892. "pj": "1",
  893. "pf": "2",
  894. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  895. }
  896. }
  897. urllib3.disable_warnings()
  898. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  899. hour_play_cnt = r.json()["data"]["play_pv"]
  900. hour_cover_url = r.json()["data"]["url"]
  901. hour_video_url = r.json()["data"]["v_url"]
  902. hour_video_duration = r.json()["data"]["du"]
  903. hour_video_comment_cnt = r.json()["data"]["comment_count"]
  904. hour_video_like_cnt = r.json()["data"]["favor"]["total"]
  905. hour_video_share_cnt = r.json()["data"]["share"]
  906. hour_video_width = r.json()["data"]["w"]
  907. hour_video_height = r.json()["data"]["h"]
  908. hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height)
  909. hour_video_send_time = r.json()["data"]["t"]
  910. hour_user_name = r.json()["data"]["user"]["nick"]
  911. hour_head_url = r.json()["data"]["user"]["hurl"]
  912. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  913. # 下载封面
  914. Common.download_method(log_type, "cover", v_title, hour_cover_url)
  915. # 下载视频
  916. Common.download_method(log_type, "video", v_title, hour_video_url)
  917. # 保存视频信息至 "./videos/{download_video_title}/info.txt"
  918. with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a:
  919. f_a.write(str(v_id) + "\n" +
  920. str(v_title) + "\n" +
  921. str(int(int(hour_video_duration) / 1000)) + "\n" +
  922. str(hour_play_cnt) + "\n" +
  923. str(hour_video_comment_cnt) + "\n" +
  924. str(hour_video_like_cnt) + "\n" +
  925. str(hour_video_share_cnt) + "\n" +
  926. str(hour_video_resolution) + "\n" +
  927. str(hour_video_send_time) + "\n" +
  928. str(hour_user_name) + "\n" +
  929. str(hour_head_url) + "\n" +
  930. str(hour_video_url) + "\n" +
  931. str(hour_cover_url) + "\n" +
  932. str("90747742180aeb22c0fe3a3c6a38f3d9"))
  933. Common.logger(log_type).info("==========视频信息已保存至info.txt==========")
  934. # 上传视频
  935. Common.logger(log_type).info("开始上传视频")
  936. our_video_id = Publish.upload_and_publish(log_type, "prod", "hour")
  937. our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(
  938. our_video_id) + "/info"
  939. Common.logger(log_type).info("视频上传完成:{}", v_title)
  940. # 上传完成时间
  941. upload_time = int(time.time())
  942. # 保存视频信息到云文档
  943. Common.logger(log_type).info("添加视频到云文档:{}", v_title)
  944. # 插入空行
  945. time.sleep(1)
  946. Feishu.insert_columns(log_type, "xiaoniangao", "yatRv2", "ROWS", 1, 2)
  947. # 视频信息写入云文档
  948. values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
  949. "小时级上升榜",
  950. v_id,
  951. v_title,
  952. our_video_link,
  953. hour_play_cnt,
  954. hour_video_comment_cnt,
  955. hour_video_like_cnt,
  956. hour_video_share_cnt,
  957. int(hour_video_duration) / 1000,
  958. hour_video_resolution,
  959. time.strftime("%Y/%m/%d %H:%M:%S",
  960. time.localtime(int(hour_video_send_time) / 1000)),
  961. hour_user_name,
  962. p_id,
  963. p_mid,
  964. hour_head_url,
  965. hour_cover_url,
  966. hour_video_url]]
  967. time.sleep(1)
  968. Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
  969. except Exception as e:
  970. Common.logger(log_type).error("下载视频异常:{}", e)
  971. elif int(ten_cnt) >= 2000 and int(fifteen_cnt) >= 2000:
  972. Common.logger(log_type).info(
  973. "10:00 and 15:00 数据上升量:{} and {} >= 2000", ten_cnt, fifteen_cnt)
  974. Common.logger(log_type).info("满足下载规则,开始下载视频")
  975. try:
  976. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  977. headers = {
  978. "x-b3-traceid": cls.hour_x_b3_traceid,
  979. "X-Token-Id": cls.hour_x_token_id,
  980. "uid": cls.hour_uid,
  981. "content-type": "application/json",
  982. "Accept-Encoding": "gzip,compress,br,deflate",
  983. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  984. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  985. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  986. "Referer": cls.hour_referer
  987. }
  988. data = {
  989. "play_src": "1",
  990. "profile_id": int(p_id),
  991. "profile_mid": int(p_mid),
  992. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  993. "!400x400r/crop/400x400/interlace/1/format/jpg",
  994. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  995. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  996. "share_width": 625,
  997. "share_height": 500,
  998. "no_comments": True,
  999. "no_follow": True,
  1000. "vid": v_id,
  1001. "hot_l1_comment": True,
  1002. "token": cls.hour_token,
  1003. "uid": cls.hour_uid,
  1004. "proj": "ma",
  1005. "wx_ver": "8.0.20",
  1006. "code_ver": "3.62.0",
  1007. "log_common_params": {
  1008. "e": [{
  1009. "data": {
  1010. "page": "dynamicSharePage"
  1011. }
  1012. }],
  1013. "ext": {
  1014. "brand": "iPhone",
  1015. "device": "iPhone 11",
  1016. "os": "iOS 14.7.1",
  1017. "weixinver": "8.0.20",
  1018. "srcver": "2.24.3",
  1019. "net": "wifi",
  1020. "scene": "1089"
  1021. },
  1022. "pj": "1",
  1023. "pf": "2",
  1024. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  1025. }
  1026. }
  1027. urllib3.disable_warnings()
  1028. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  1029. hour_play_cnt = r.json()["data"]["play_pv"]
  1030. hour_cover_url = r.json()["data"]["url"]
  1031. hour_video_url = r.json()["data"]["v_url"]
  1032. hour_video_duration = r.json()["data"]["du"]
  1033. hour_video_comment_cnt = r.json()["data"]["comment_count"]
  1034. hour_video_like_cnt = r.json()["data"]["favor"]["total"]
  1035. hour_video_share_cnt = r.json()["data"]["share"]
  1036. hour_video_width = r.json()["data"]["w"]
  1037. hour_video_height = r.json()["data"]["h"]
  1038. hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height)
  1039. hour_video_send_time = r.json()["data"]["t"]
  1040. hour_user_name = r.json()["data"]["user"]["nick"]
  1041. hour_head_url = r.json()["data"]["user"]["hurl"]
  1042. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  1043. # 下载封面
  1044. Common.download_method(log_type, "cover", v_title, hour_cover_url)
  1045. # 下载视频
  1046. Common.download_method(log_type, "video", v_title, hour_video_url)
  1047. # 保存视频信息至 "./videos/{download_video_title}/info.txt"
  1048. with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a:
  1049. f_a.write(str(v_id) + "\n" +
  1050. str(v_title) + "\n" +
  1051. str(int(int(hour_video_duration) / 1000)) + "\n" +
  1052. str(hour_play_cnt) + "\n" +
  1053. str(hour_video_comment_cnt) + "\n" +
  1054. str(hour_video_like_cnt) + "\n" +
  1055. str(hour_video_share_cnt) + "\n" +
  1056. str(hour_video_resolution) + "\n" +
  1057. str(hour_video_send_time) + "\n" +
  1058. str(hour_user_name) + "\n" +
  1059. str(hour_head_url) + "\n" +
  1060. str(hour_video_url) + "\n" +
  1061. str(hour_cover_url) + "\n" +
  1062. str("90747742180aeb22c0fe3a3c6a38f3d9"))
  1063. Common.logger(log_type).info("==========视频信息已保存至info.txt==========")
  1064. # 上传
  1065. Common.logger(log_type).info("开始上传视频")
  1066. our_video_id = Publish.upload_and_publish(log_type, "prod", "hour")
  1067. our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(
  1068. our_video_id) + "/info"
  1069. Common.logger(log_type).info("视频上传完成:{}", v_title)
  1070. # 上传完成时间
  1071. upload_time = int(time.time())
  1072. # 保存视频信息到云文档
  1073. Common.logger(log_type).info("添加视频到云文档:{}", v_title)
  1074. # 插入空行
  1075. time.sleep(1)
  1076. Feishu.insert_columns(log_type, "xiaoniangao", "yatRv2", "ROWS", 1, 2)
  1077. # 视频信息写入云文档
  1078. values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
  1079. "小时级上升榜",
  1080. v_id,
  1081. v_title,
  1082. our_video_link,
  1083. hour_play_cnt,
  1084. hour_video_comment_cnt,
  1085. hour_video_like_cnt,
  1086. hour_video_share_cnt,
  1087. int(hour_video_duration) / 1000,
  1088. hour_video_resolution,
  1089. time.strftime("%Y/%m/%d %H:%M:%S",
  1090. time.localtime(int(hour_video_send_time) / 1000)),
  1091. hour_user_name,
  1092. p_id,
  1093. p_mid,
  1094. hour_head_url,
  1095. hour_cover_url,
  1096. hour_video_url]]
  1097. time.sleep(1)
  1098. Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
  1099. except Exception as e:
  1100. Common.logger(log_type).error("下载视频异常:{}", e)
  1101. elif int(fifteen_cnt) >= 2000 and int(twenty_cnt) >= 2000:
  1102. Common.logger(log_type).info(
  1103. "15:00 and 20:00 数据上升量:{} and {} >= 2000", fifteen_cnt, twenty_cnt)
  1104. Common.logger(log_type).info("满足下载规则,开始下载视频")
  1105. try:
  1106. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  1107. headers = {
  1108. "x-b3-traceid": cls.hour_x_b3_traceid,
  1109. "X-Token-Id": cls.hour_x_token_id,
  1110. "uid": cls.hour_uid,
  1111. "content-type": "application/json",
  1112. "Accept-Encoding": "gzip,compress,br,deflate",
  1113. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  1114. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  1115. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  1116. "Referer": cls.hour_referer
  1117. }
  1118. data = {
  1119. "play_src": "1",
  1120. "profile_id": int(p_id),
  1121. "profile_mid": int(p_mid),
  1122. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  1123. "!400x400r/crop/400x400/interlace/1/format/jpg",
  1124. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  1125. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  1126. "share_width": 625,
  1127. "share_height": 500,
  1128. "no_comments": True,
  1129. "no_follow": True,
  1130. "vid": v_id,
  1131. "hot_l1_comment": True,
  1132. "token": cls.hour_token,
  1133. "uid": cls.hour_uid,
  1134. "proj": "ma",
  1135. "wx_ver": "8.0.20",
  1136. "code_ver": "3.62.0",
  1137. "log_common_params": {
  1138. "e": [{
  1139. "data": {
  1140. "page": "dynamicSharePage"
  1141. }
  1142. }],
  1143. "ext": {
  1144. "brand": "iPhone",
  1145. "device": "iPhone 11",
  1146. "os": "iOS 14.7.1",
  1147. "weixinver": "8.0.20",
  1148. "srcver": "2.24.3",
  1149. "net": "wifi",
  1150. "scene": "1089"
  1151. },
  1152. "pj": "1",
  1153. "pf": "2",
  1154. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  1155. }
  1156. }
  1157. urllib3.disable_warnings()
  1158. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  1159. hour_play_cnt = r.json()["data"]["play_pv"]
  1160. hour_cover_url = r.json()["data"]["url"]
  1161. hour_video_url = r.json()["data"]["v_url"]
  1162. hour_video_duration = r.json()["data"]["du"]
  1163. hour_video_comment_cnt = r.json()["data"]["comment_count"]
  1164. hour_video_like_cnt = r.json()["data"]["favor"]["total"]
  1165. hour_video_share_cnt = r.json()["data"]["share"]
  1166. hour_video_width = r.json()["data"]["w"]
  1167. hour_video_height = r.json()["data"]["h"]
  1168. hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height)
  1169. hour_video_send_time = r.json()["data"]["t"]
  1170. hour_user_name = r.json()["data"]["user"]["nick"]
  1171. hour_head_url = r.json()["data"]["user"]["hurl"]
  1172. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  1173. # 下载封面
  1174. Common.download_method(log_type, "cover", v_title, hour_cover_url)
  1175. # 下载视频
  1176. Common.download_method(log_type, "video", v_title, hour_video_url)
  1177. # 保存视频信息至 "./videos/{download_video_title}/info.txt"
  1178. with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a:
  1179. f_a.write(str(v_id) + "\n" +
  1180. str(v_title) + "\n" +
  1181. str(int(int(hour_video_duration) / 1000)) + "\n" +
  1182. str(hour_play_cnt) + "\n" +
  1183. str(hour_video_comment_cnt) + "\n" +
  1184. str(hour_video_like_cnt) + "\n" +
  1185. str(hour_video_share_cnt) + "\n" +
  1186. str(hour_video_resolution) + "\n" +
  1187. str(hour_video_send_time) + "\n" +
  1188. str(hour_user_name) + "\n" +
  1189. str(hour_head_url) + "\n" +
  1190. str(hour_video_url) + "\n" +
  1191. str(hour_cover_url) + "\n" +
  1192. str("90747742180aeb22c0fe3a3c6a38f3d9"))
  1193. Common.logger(log_type).info("==========视频信息已保存至info.txt==========")
  1194. # 上传
  1195. Common.logger(log_type).info("开始上传视频")
  1196. our_video_id = Publish.upload_and_publish(log_type, "prod", "hour")
  1197. our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(
  1198. our_video_id) + "/info"
  1199. Common.logger(log_type).info("视频上传完成:{}", v_title)
  1200. # 上传完成时间
  1201. upload_time = int(time.time())
  1202. # 保存视频信息到云文档
  1203. Common.logger(log_type).info("添加视频到云文档:{}", v_title)
  1204. # 插入空行
  1205. time.sleep(1)
  1206. Feishu.insert_columns(log_type, "xiaoniangao", "yatRv2", "ROWS", 1, 2)
  1207. # 视频信息写入云文档
  1208. values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
  1209. "小时级上升榜",
  1210. v_id,
  1211. v_title,
  1212. our_video_link,
  1213. hour_play_cnt,
  1214. hour_video_comment_cnt,
  1215. hour_video_like_cnt,
  1216. hour_video_share_cnt,
  1217. int(hour_video_duration) / 1000,
  1218. hour_video_resolution,
  1219. time.strftime("%Y/%m/%d %H:%M:%S",
  1220. time.localtime(int(hour_video_send_time) / 1000)),
  1221. hour_user_name,
  1222. p_id,
  1223. p_mid,
  1224. hour_head_url,
  1225. hour_cover_url,
  1226. hour_video_url]]
  1227. time.sleep(1)
  1228. Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
  1229. except Exception as e:
  1230. Common.logger(log_type).error("下载视频异常:{}", e)
  1231. elif int(yesterday_twenty_cnt) >= 2000 and int(ten_cnt) >= 2000:
  1232. Common.logger(log_type).info("昨日20:00 and 今日10:00 数据上升量:{} and {} >= 2000",
  1233. yesterday_twenty_cnt, ten_cnt)
  1234. Common.logger(log_type).info("满足下载规则,开始下载视频")
  1235. try:
  1236. url = "https://kapi.xiaoniangao.cn/profile/get_profile_by_id"
  1237. headers = {
  1238. "x-b3-traceid": cls.hour_x_b3_traceid,
  1239. "X-Token-Id": cls.hour_x_token_id,
  1240. "uid": cls.hour_uid,
  1241. "content-type": "application/json",
  1242. "Accept-Encoding": "gzip,compress,br,deflate",
  1243. "User-Agent": 'Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X)'
  1244. ' AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 '
  1245. 'MicroMessenger/8.0.20(0x18001432) NetType/WIFI Language/zh_CN',
  1246. "Referer": cls.hour_referer
  1247. }
  1248. data = {
  1249. "play_src": "1",
  1250. "profile_id": int(p_id),
  1251. "profile_mid": int(p_mid),
  1252. "qs": "imageMogr2/gravity/center/rotate/$/thumbnail/"
  1253. "!400x400r/crop/400x400/interlace/1/format/jpg",
  1254. "h_qs": "imageMogr2/gravity/center/rotate/$/thumbnail"
  1255. "/!80x80r/crop/80x80/interlace/1/format/jpg",
  1256. "share_width": 625,
  1257. "share_height": 500,
  1258. "no_comments": True,
  1259. "no_follow": True,
  1260. "vid": v_id,
  1261. "hot_l1_comment": True,
  1262. "token": cls.hour_token,
  1263. "uid": cls.hour_uid,
  1264. "proj": "ma",
  1265. "wx_ver": "8.0.20",
  1266. "code_ver": "3.62.0",
  1267. "log_common_params": {
  1268. "e": [{
  1269. "data": {
  1270. "page": "dynamicSharePage"
  1271. }
  1272. }],
  1273. "ext": {
  1274. "brand": "iPhone",
  1275. "device": "iPhone 11",
  1276. "os": "iOS 14.7.1",
  1277. "weixinver": "8.0.20",
  1278. "srcver": "2.24.3",
  1279. "net": "wifi",
  1280. "scene": "1089"
  1281. },
  1282. "pj": "1",
  1283. "pf": "2",
  1284. "session_id": "7bcce313-b57d-4305-8d14-6ebd9a1bad29"
  1285. }
  1286. }
  1287. urllib3.disable_warnings()
  1288. r = requests.post(headers=headers, url=url, json=data, proxies=proxies, verify=False)
  1289. hour_play_cnt = r.json()["data"]["play_pv"]
  1290. hour_cover_url = r.json()["data"]["url"]
  1291. hour_video_url = r.json()["data"]["v_url"]
  1292. hour_video_duration = r.json()["data"]["du"]
  1293. hour_video_comment_cnt = r.json()["data"]["comment_count"]
  1294. hour_video_like_cnt = r.json()["data"]["favor"]["total"]
  1295. hour_video_share_cnt = r.json()["data"]["share"]
  1296. hour_video_width = r.json()["data"]["w"]
  1297. hour_video_height = r.json()["data"]["h"]
  1298. hour_video_resolution = str(hour_video_width) + "*" + str(hour_video_height)
  1299. hour_video_send_time = r.json()["data"]["t"]
  1300. hour_user_name = r.json()["data"]["user"]["nick"]
  1301. hour_head_url = r.json()["data"]["user"]["hurl"]
  1302. Common.logger(log_type).info("视频详情,当前播放量:{}", hour_play_cnt)
  1303. # 下载封面
  1304. Common.download_method(log_type, "cover", v_title, hour_cover_url)
  1305. # 下载视频
  1306. Common.download_method(log_type, "video", v_title, hour_video_url)
  1307. # 保存视频信息至 "./videos/{download_video_title}/info.txt"
  1308. with open("./videos/" + v_title + "/" + "info.txt", "a", encoding="UTF-8") as f_a:
  1309. f_a.write(str(v_id) + "\n" +
  1310. str(v_title) + "\n" +
  1311. str(int(int(hour_video_duration) / 1000)) + "\n" +
  1312. str(hour_play_cnt) + "\n" +
  1313. str(hour_video_comment_cnt) + "\n" +
  1314. str(hour_video_like_cnt) + "\n" +
  1315. str(hour_video_share_cnt) + "\n" +
  1316. str(hour_video_resolution) + "\n" +
  1317. str(hour_video_send_time) + "\n" +
  1318. str(hour_user_name) + "\n" +
  1319. str(hour_head_url) + "\n" +
  1320. str(hour_video_url) + "\n" +
  1321. str(hour_cover_url) + "\n" +
  1322. str("90747742180aeb22c0fe3a3c6a38f3d9"))
  1323. Common.logger(log_type).info("==========视频信息已保存至info.txt==========")
  1324. # 上传
  1325. Common.logger(log_type).info("开始上传视频")
  1326. our_video_id = Publish.upload_and_publish(log_type, "prod", "hour")
  1327. our_video_link = "https://admin.piaoquantv.com/cms/post-detail/" + str(
  1328. our_video_id) + "/info"
  1329. Common.logger(log_type).info("视频上传完成:{}", v_title)
  1330. # 上传完成时间
  1331. upload_time = int(time.time())
  1332. # 保存视频信息到云文档
  1333. Common.logger(log_type).info("添加视频到云文档:{}", v_title)
  1334. # 插入空行
  1335. time.sleep(1)
  1336. Feishu.insert_columns(log_type, "xiaoniangao", "yatRv2", "ROWS", 1, 2)
  1337. # 视频信息写入云文档
  1338. values = [[time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(upload_time))),
  1339. "小时级上升榜",
  1340. v_id,
  1341. v_title,
  1342. our_video_link,
  1343. hour_play_cnt,
  1344. hour_video_comment_cnt,
  1345. hour_video_like_cnt,
  1346. hour_video_share_cnt,
  1347. int(hour_video_duration) / 1000,
  1348. hour_video_resolution,
  1349. time.strftime("%Y/%m/%d %H:%M:%S",
  1350. time.localtime(int(hour_video_send_time) / 1000)),
  1351. hour_user_name,
  1352. p_id,
  1353. p_mid,
  1354. hour_head_url,
  1355. hour_cover_url,
  1356. hour_video_url]]
  1357. time.sleep(1)
  1358. Feishu.update_values(log_type, "xiaoniangao", "yatRv2", "F2:W2", values)
  1359. except Exception as e:
  1360. Common.logger(log_type).error("下载视频异常:{}", e)
  1361. else:
  1362. Common.logger(log_type).info("上升量不满足下载规则")
  1363. except Exception as e:
  1364. Common.logger(log_type).error("下载视频时,获取飞书信息异常:{}\n", e)
  1365. if __name__ == "__main__":
  1366. HourList.get_hour_list_feeds("hour")
  1367. pass