Ver código fonte

数量数据类型转换为 int

wangkun 2 anos atrás
pai
commit
94ab25fcb9
2 arquivos alterados com 13 adições e 14 exclusões
  1. 12 12
      main/recommend.py
  2. 1 2
      main/run_recommend.py

+ 12 - 12
main/recommend.py

@@ -147,14 +147,14 @@ class Recommend:
                     else:
                         video_url = feeds[i]["video_url"]
 
-                    if "width" not in feeds[i] or "height" not in feeds[i]:
-                        video_width = 0
-                        video_height = 0
-                        video_resolution = str(video_width) + "*" + str(video_height)
-                    else:
-                        video_width = feeds[i]["width"]
-                        video_height = feeds[i]["height"]
-                        video_resolution = str(video_width) + "*" + str(video_height)
+                    # if "width" not in feeds[i] or "height" not in feeds[i]:
+                    #     video_width = 0
+                    #     video_height = 0
+                    #     video_resolution = str(video_width) + "*" + str(video_height)
+                    # else:
+                    #     video_width = feeds[i]["width"]
+                    #     video_height = feeds[i]["height"]
+                    #     video_resolution = str(video_width) + "*" + str(video_height)
 
                     if "commentCount" not in feeds[i]:
                         video_comment_cnt = 0
@@ -214,10 +214,10 @@ class Recommend:
                                    "推荐榜",
                                    str(video_id),
                                    video_title,
-                                   play_cnt,
-                                   like_cnt,
-                                   share_cnt,
-                                   video_comment_cnt,
+                                   int(play_cnt),
+                                   int(like_cnt),
+                                   int(share_cnt),
+                                   int(video_comment_cnt),
                                    time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(int(video_send_time))),
                                    user_name,
                                    user_id,

+ 1 - 2
main/run_recommend.py

@@ -3,10 +3,9 @@
 # @Time: 2022/4/25
 import datetime
 import os
-import random
+# import random
 import sys
 import time
-
 sys.path.append(os.getcwd())
 from main.common import Common
 from main.recommend import Recommend