|
@@ -58,6 +58,8 @@ class VideoStitching():
|
|
|
formatted_time = current_time.strftime("%Y-%m-%d")
|
|
|
if channel_type == "douyin":
|
|
|
video_type = 0
|
|
|
+ elif channel_type == "kschunjie":
|
|
|
+ video_type = 4
|
|
|
else:
|
|
|
video_type = 2
|
|
|
for j in audio_url:
|
|
@@ -119,6 +121,12 @@ class VideoStitching():
|
|
|
url_list = MysqlHelper.get_values(url_list, "prod")
|
|
|
return url_list
|
|
|
|
|
|
+ @classmethod
|
|
|
+ def get_zizhi_url_list(cls, account):
|
|
|
+ url_list = f"""SELECT video_id,account_id,oss_object_key FROM video_url where account_id = {account} limit 35;"""
|
|
|
+ url_list = MysqlHelper.get_values(url_list, "prod")
|
|
|
+ return url_list
|
|
|
+
|
|
|
@classmethod
|
|
|
def get_audio_url_list(cls, videos, audio_id):
|
|
|
url_list = f"""SELECT audio FROM video_audio where audio = {audio_id} and oss_object_key = '{videos}';"""
|
|
@@ -129,50 +137,88 @@ class VideoStitching():
|
|
|
@classmethod
|
|
|
def insert_piaoquantv(cls, oss_object_key, title_list, video_type, channel_type):
|
|
|
#list = ["66481136", "66481137", "66481140", "66481141", "66481142"] 老用户id
|
|
|
- if video_type == "口播--美文类":
|
|
|
- list = ["67231152", "67231153", "67231154", "67231155", "67231157"]
|
|
|
+ if video_type == "自制--春节":
|
|
|
+ list = ['15924999', '50322241', '50322258', '57463797', '50322235', '57463790', '50322234', '6605563', '18981907', '50322198', '50322239', '57463838', '14500202']
|
|
|
+ code = 1
|
|
|
+ for i in range(len(list)):
|
|
|
+ title_list = [item for item in title_list if item is not None]
|
|
|
+ title = random.choice(title_list)
|
|
|
+ # title = title[0].strip("[]'")
|
|
|
+ url = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send"
|
|
|
+ payload = dict(pageSource='vlog-pages/post/post-video-post', videoPath=oss_object_key, width='720',
|
|
|
+ height='1280', fileExtensions='mp4', viewStatus='1', title=title, careModelStatus='1',
|
|
|
+ token='f04f58d6e664cbc9902660a1e8d20ce6cd7fdb0f', loginUid=list[i], versionCode='719',
|
|
|
+ machineCode='weixin_openid_o0w175aZ4FJtqVsA1tcozJDJHdDU', appId='wx89e7eb06478361d7',
|
|
|
+ clientTimestamp='1703337579331',
|
|
|
+ machineInfo='{"sdkVersion":"3.2.5","brand":"iPhone","language":"zh_CN","model":"iPhone 12 Pro<iPhone13,3>","platform":"ios","system":"iOS 15.6.1","weChatVersion":"8.0.44","screenHeight":844,"screenWidth":390,"pixelRatio":3,"windowHeight":762,"windowWidth":390,"softVersion":"4.1.719"}',
|
|
|
+ sessionId='1703337560040-27bfe208-a389-f476-db1d-840681e04b32',
|
|
|
+ subSessionId='1703337569952-8f56d53c-b36d-760e-8abe-0b4a027cd5bd', senceType='1089',
|
|
|
+ hotSenceType='1089', id='1050', channel='pq')
|
|
|
+
|
|
|
+ payload['videoPath'] = oss_object_key
|
|
|
+ payload['title'] = title
|
|
|
+
|
|
|
+ data = urllib.parse.urlencode(payload)
|
|
|
+
|
|
|
+ headers = {
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.44(0x18002c2d) NetType/WIFI Language/zh_CN',
|
|
|
+ 'Accept-Encoding': 'gzip,compress,br,deflate',
|
|
|
+ 'Referer': 'https://servicewechat.com/wx89e7eb06478361d7/726/page-frame.html',
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
+ 'Cookie': 'JSESSIONID=A60D96E7A300A25EA05425B069C8B459'
|
|
|
+ }
|
|
|
+
|
|
|
+ response = requests.post(url, data=data, headers=headers)
|
|
|
+ data = response.json()
|
|
|
+ code = data["code"]
|
|
|
+ if code == 0:
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ return False
|
|
|
else:
|
|
|
- if channel_type == "douyin":
|
|
|
+ if video_type == "口播--美文类":
|
|
|
+ list = ["67231152", "67231153", "67231154", "67231155", "67231157"]
|
|
|
+ elif channel_type == "douyin":
|
|
|
list = ["67231113", "67231112", "67231111", "67231110", "67231109"]
|
|
|
else:
|
|
|
list = ["67413406", "67413407", "67413408", "67413409", "67413410"]
|
|
|
- code = 1
|
|
|
- for i in range(2):
|
|
|
- item = random.choice(list)
|
|
|
- title_list = [item for item in title_list if item is not None]
|
|
|
- title = random.choice(title_list)
|
|
|
- # title = title[0].strip("[]'")
|
|
|
- url = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send"
|
|
|
- payload = dict(pageSource='vlog-pages/post/post-video-post', videoPath=oss_object_key, width='720',
|
|
|
- height='1280', fileExtensions='mp4', viewStatus='1', title=title, careModelStatus='1',
|
|
|
- token='f04f58d6e664cbc9902660a1e8d20ce6cd7fdb0f', loginUid=item, versionCode='719',
|
|
|
- machineCode='weixin_openid_o0w175aZ4FJtqVsA1tcozJDJHdDU', appId='wx89e7eb06478361d7',
|
|
|
- clientTimestamp='1703337579331',
|
|
|
- machineInfo='{"sdkVersion":"3.2.5","brand":"iPhone","language":"zh_CN","model":"iPhone 12 Pro<iPhone13,3>","platform":"ios","system":"iOS 15.6.1","weChatVersion":"8.0.44","screenHeight":844,"screenWidth":390,"pixelRatio":3,"windowHeight":762,"windowWidth":390,"softVersion":"4.1.719"}',
|
|
|
- sessionId='1703337560040-27bfe208-a389-f476-db1d-840681e04b32',
|
|
|
- subSessionId='1703337569952-8f56d53c-b36d-760e-8abe-0b4a027cd5bd', senceType='1089',
|
|
|
- hotSenceType='1089', id='1050', channel='pq')
|
|
|
-
|
|
|
- payload['videoPath'] = oss_object_key
|
|
|
- payload['title'] = title
|
|
|
-
|
|
|
- data = urllib.parse.urlencode(payload)
|
|
|
-
|
|
|
- headers = {
|
|
|
- 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.44(0x18002c2d) NetType/WIFI Language/zh_CN',
|
|
|
- 'Accept-Encoding': 'gzip,compress,br,deflate',
|
|
|
- 'Referer': 'https://servicewechat.com/wx89e7eb06478361d7/726/page-frame.html',
|
|
|
- 'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
- 'Cookie': 'JSESSIONID=A60D96E7A300A25EA05425B069C8B459'
|
|
|
- }
|
|
|
-
|
|
|
- response = requests.post(url, data=data, headers=headers)
|
|
|
- data = response.json()
|
|
|
- code = data["code"]
|
|
|
- if code == 0:
|
|
|
- return True
|
|
|
- else:
|
|
|
- return False
|
|
|
+ code = 1
|
|
|
+ for i in range(2):
|
|
|
+ item = random.choice(list)
|
|
|
+ title_list = [item for item in title_list if item is not None]
|
|
|
+ title = random.choice(title_list)
|
|
|
+ # title = title[0].strip("[]'")
|
|
|
+ url = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send"
|
|
|
+ payload = dict(pageSource='vlog-pages/post/post-video-post', videoPath=oss_object_key, width='720',
|
|
|
+ height='1280', fileExtensions='mp4', viewStatus='1', title=title, careModelStatus='1',
|
|
|
+ token='f04f58d6e664cbc9902660a1e8d20ce6cd7fdb0f', loginUid=item, versionCode='719',
|
|
|
+ machineCode='weixin_openid_o0w175aZ4FJtqVsA1tcozJDJHdDU', appId='wx89e7eb06478361d7',
|
|
|
+ clientTimestamp='1703337579331',
|
|
|
+ machineInfo='{"sdkVersion":"3.2.5","brand":"iPhone","language":"zh_CN","model":"iPhone 12 Pro<iPhone13,3>","platform":"ios","system":"iOS 15.6.1","weChatVersion":"8.0.44","screenHeight":844,"screenWidth":390,"pixelRatio":3,"windowHeight":762,"windowWidth":390,"softVersion":"4.1.719"}',
|
|
|
+ sessionId='1703337560040-27bfe208-a389-f476-db1d-840681e04b32',
|
|
|
+ subSessionId='1703337569952-8f56d53c-b36d-760e-8abe-0b4a027cd5bd', senceType='1089',
|
|
|
+ hotSenceType='1089', id='1050', channel='pq')
|
|
|
+
|
|
|
+ payload['videoPath'] = oss_object_key
|
|
|
+ payload['title'] = title
|
|
|
+
|
|
|
+ data = urllib.parse.urlencode(payload)
|
|
|
+
|
|
|
+ headers = {
|
|
|
+ 'User-Agent': 'Mozilla/5.0 (iPhone; CPU iPhone OS 15_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 MicroMessenger/8.0.44(0x18002c2d) NetType/WIFI Language/zh_CN',
|
|
|
+ 'Accept-Encoding': 'gzip,compress,br,deflate',
|
|
|
+ 'Referer': 'https://servicewechat.com/wx89e7eb06478361d7/726/page-frame.html',
|
|
|
+ 'Content-Type': 'application/x-www-form-urlencoded',
|
|
|
+ 'Cookie': 'JSESSIONID=A60D96E7A300A25EA05425B069C8B459'
|
|
|
+ }
|
|
|
+
|
|
|
+ response = requests.post(url, data=data, headers=headers)
|
|
|
+ data = response.json()
|
|
|
+ code = data["code"]
|
|
|
+ if code == 0:
|
|
|
+ return True
|
|
|
+ else:
|
|
|
+ return False
|
|
|
|
|
|
|
|
|
# 视频拼接
|
|
@@ -361,10 +407,22 @@ class VideoStitching():
|
|
|
videos = [list(item) for item in audio_list]
|
|
|
videos = random.choice(videos) #随机选择视频
|
|
|
# 判断该视频+音频是否生成过视频
|
|
|
- video = VideoStitching.get_audio_url_list(videos, audio_id)
|
|
|
- if video:
|
|
|
- Common.logger("video").info(f"该视频+音频已经生成过视频,不做视频拼接")
|
|
|
+ # video = VideoStitching.get_audio_url_list(videos, audio_id)
|
|
|
+ # if video:
|
|
|
+ # Common.logger("video").info(f"该视频+音频已经生成过视频,不做视频拼接")
|
|
|
+ # return
|
|
|
+ elif video_type == "自制--春节":
|
|
|
+ # 获取已入库的用户id
|
|
|
+ account_id = cls.get_account_id(channel_type)
|
|
|
+ account = random.choice(account_id)
|
|
|
+ account = str(account).replace('(', '').replace(')', '').replace(',', '')
|
|
|
+ Common.logger("video").info(f"获取用户ID:{account}")
|
|
|
+ # 获取视频链接
|
|
|
+ url_list = cls.get_zizhi_url_list(account)
|
|
|
+ if url_list == None:
|
|
|
+ Common.logger("video").info(f"未使用视频链接为空:{url_list}")
|
|
|
return
|
|
|
+ videos = [list(item) for item in url_list]
|
|
|
else:
|
|
|
# 获取已入库的用户id
|
|
|
account_id = cls.get_account_id(channel_type)
|