|
@@ -3,8 +3,6 @@
|
|
|
# @Time: 2023/5/15
|
|
|
import random
|
|
|
import time
|
|
|
-
|
|
|
-from common.common import Common
|
|
|
from common.scheduling_db import MysqlHelper
|
|
|
|
|
|
|
|
@@ -74,8 +72,62 @@ class Demo:
|
|
|
continue
|
|
|
return True
|
|
|
|
|
|
+ @classmethod
|
|
|
+ def save_video_info(cls):
|
|
|
+ video_dict = {'video_title': "测试视频标题",
|
|
|
+ 'video_id': "id_1",
|
|
|
+ 'play_cnt': 199,
|
|
|
+ 'publish_time_stamp': 1683648000,
|
|
|
+ 'publish_time_str': "2023-05-10 00:00:00",
|
|
|
+ 'user_name': "岁岁年年迎福气",
|
|
|
+ 'user_id': "suisuiniannianyingfuqi",
|
|
|
+ 'avatar_url': "https://cdn.jzkksp.com/2022/3/22/lnchd2.jpg?auth_key=1684223012-0-0-2f8ddcf0e5d5f164f792b77c98e1ffde",
|
|
|
+ 'cover_url': "https://cdn.jzkksp.com/2022/3/22/lnchd2.jpg?auth_key=1684223012-0-0-2f8ddcf0e5d5f164f792b77c98e1ffde",
|
|
|
+ 'video_url': "https://cdn.jzkksp.com/2022/3/22/lnchd.mp4",
|
|
|
+ 'session': f"suisuiniannianyingfuqi-{int(time.time())}"}
|
|
|
+ save_dict = {
|
|
|
+ "video_title": "video_title",
|
|
|
+ "video_id": "video_id",
|
|
|
+ "duration": 0,
|
|
|
+ "play_cnt": 0,
|
|
|
+ "comment_cnt": 0,
|
|
|
+ "like_cnt": 0,
|
|
|
+ "share_cnt": 0,
|
|
|
+ "video_width": 1920,
|
|
|
+ "video_height": 1080,
|
|
|
+ "publish_time_stamp": 946656000, # 2000-01-01 00:00:00
|
|
|
+ "user_name": "crawler",
|
|
|
+ "avatar_url": "http://weapppiccdn.yishihui.com/resources/images/pic_normal.png",
|
|
|
+ "video_url": "video_url",
|
|
|
+ "cover_url": "cover_url",
|
|
|
+ "session": f"session-{int(time.time())}",
|
|
|
+
|
|
|
+ }
|
|
|
+ for video_key, video_value in video_dict.items():
|
|
|
+ for save_key, save_value in save_dict.items():
|
|
|
+ if save_key == video_key:
|
|
|
+ save_dict[save_key] = video_value
|
|
|
+ for k, v in save_dict.items():
|
|
|
+ print(f"{k}:{v}")
|
|
|
+ with open(f"./info.txt", "w", encoding="UTF-8") as f_a:
|
|
|
+ f_a.write(str(save_dict['video_id']) + "\n" +
|
|
|
+ str(save_dict['video_title']) + "\n" +
|
|
|
+ str(save_dict['duration']) + "\n" +
|
|
|
+ str(save_dict['play_cnt']) + "\n" +
|
|
|
+ str(save_dict['comment_cnt']) + "\n" +
|
|
|
+ str(save_dict['like_cnt']) + "\n" +
|
|
|
+ str(save_dict['share_cnt']) + "\n" +
|
|
|
+ f"{save_dict['video_width']}*{save_dict['video_height']}" + "\n" +
|
|
|
+ str(save_dict['publish_time_stamp']) + "\n" +
|
|
|
+ str(save_dict['user_name']) + "\n" +
|
|
|
+ str(save_dict['avatar_url']) + "\n" +
|
|
|
+ str(save_dict['video_url']) + "\n" +
|
|
|
+ str(save_dict['cover_url']) + "\n" +
|
|
|
+ str(save_dict['session']))
|
|
|
+
|
|
|
if __name__ == "__main__":
|
|
|
# Demo.get_user("demo", "suisuiniannianyingfuqi", "dev")
|
|
|
- print(Demo.test_dict())
|
|
|
+ # print(Demo.test_dict())
|
|
|
# print(500 <= 1000 <= 100000000)
|
|
|
+ Demo.save_video_info()
|
|
|
pass
|