zhangyong vor 5 Monaten
Ursprung
Commit
165ef12224

+ 48 - 39
common/feishu_form.py

@@ -98,18 +98,19 @@ class Material():
             for row in data[1:]:
                 channel_id = row[1]
                 channel_url = str(row[2])
-                piaoquan_id = row[3]
-                number = row[4]
-                video_share = row[5]
-                video_ending = row[6]
-                voice = row[7]
-                crop_tool = row[8]
-                gg_duration = row[9]
-                title = row[10]
+                tags = row[3]
+                piaoquan_id = row[4]
+                number = row[5]
+                video_share = row[6]
+                video_ending = row[7]
+                voice = row[8]
+                crop_tool = row[9]
+                gg_duration = row[10]
+                title = row[11]
                 if channel_url == None or channel_url == "" or len(channel_url) == 0:
                     continue
-                first_category = row[12]  # 一级品类
-                secondary_category = row[13]  # 二级品类
+                first_category = row[13]  # 一级品类
+                secondary_category = row[14]  # 二级品类
                 def count_items(item, separator):
                     if item and item not in {'None', ''}:
                         return len(item.split(separator))
@@ -120,10 +121,10 @@ class Material():
                 values = [channel_id, video_id_total, piaoquan_id, video_share, video_ending_total, crop_tool, gg_duration, title_total, first_category]
                 filtered_values = [str(value) for value in values if value is not None and value != "None"]
                 task_mark = "_".join(map(str, filtered_values))
-                keyword_sort = row[14]  # 排序条件
-                keyword_time = row[15]  # 发布时间
-                keyword_duration = row[16]  # 视频时长
-                keyword_name = row[17]  # 负责人
+                keyword_sort = row[15]  # 排序条件
+                keyword_time = row[16]  # 发布时间
+                keyword_duration = row[17]  # 视频时长
+                keyword_name = row[18]  # 负责人
                 keyword_sort_list = keyword_sort.split(',')
                 keyword_duration_list = keyword_duration.split(',')
                 keyword_time_list = keyword_time.split(',')
@@ -149,7 +150,9 @@ class Material():
                             "first_category": first_category,  # 一级品类
                             "secondary_category": secondary_category,  # 二级品类
                             "combo": combo,  # 搜索条件
-                            "keyword_name": keyword_name  # 品类负责人
+                            "keyword_name": keyword_name,  # 品类负责人
+                            "tags": tags
+
                         }
                         processed_list.append(json.dumps(number_dict, ensure_ascii=False))
         except:
@@ -169,22 +172,23 @@ class Material():
             for row in data[1:]:
                 channel_id = row[1]
                 channel_url = str( row[2] )
-                piaoquan_id = row[3]
-                number = row[4]
-                video_share = row[5]
-                video_ending = row[6]
-                voice = row[7]
-                crop_tool = row[8]
-                gg_duration = row[9]
-                title = row[10]
+                tags = row[3]
+                piaoquan_id = row[4]
+                number = row[5]
+                video_share = row[6]
+                video_ending = row[7]
+                voice = row[8]
+                crop_tool = row[9]
+                gg_duration = row[10]
+                title = row[11]
                 if channel_url == None or channel_url == "" or len( channel_url ) == 0:
                     continue
                 try:
-                    ls_number = int( row[11] )
+                    ls_number = int( row[12] )
                 except:
                     ls_number = None
-                first_category = row[12]
-                name = row[13]
+                first_category = row[13]
+                name = row[14]
 
                 def count_items(item, separator):
                     if item and item not in {'None', ''}:
@@ -217,7 +221,8 @@ class Material():
                             "gg_duration_total": gg_duration,
                             "voice": voice,
                             "first_category": first_category,  # 一级品类
-                            "keyword_name":name
+                            "keyword_name":name,
+                            "tags": tags
                         }
                         processed_list.append( json.dumps( number_dict, ensure_ascii=False ) )
                         if channel_id == "抖音" or channel_id == "快手" or channel_id == "视频号":
@@ -248,7 +253,8 @@ class Material():
                                     "gg_duration_total": gg_duration,
                                     "voice": voice,
                                     "first_category": first_category,  # 一级品类
-                                    "keyword_name": name
+                                    "keyword_name": name,
+                                    "tags": tags
                                 }
                                 processed_list.append( json.dumps( number_dict, ensure_ascii=False ) )
                 else:
@@ -271,18 +277,19 @@ class Material():
             for row in data[1:]:
                 channel_id = row[1]
                 channel_url = str(row[2])
-                piaoquan_id = row[3]
-                number = row[4]
-                video_share = row[5]
-                video_ending = row[6]
-                voice = row[7]
-                crop_tool = row[8]
-                gg_duration = row[9]
-                title = row[10]
+                tags = row[3]
+                piaoquan_id = row[4]
+                number = row[5]
+                video_share = row[6]
+                video_ending = row[7]
+                voice = row[8]
+                crop_tool = row[9]
+                gg_duration = row[10]
+                title = row[11]
                 if channel_url == None or channel_url == "" or len(channel_url) == 0:
                     continue
                 try:
-                    ls_number = int(row[11])
+                    ls_number = int(row[12])
                 except:
                     ls_number = None
                 def count_items(item, separator):
@@ -312,7 +319,8 @@ class Material():
                             "video_ending": video_ending,
                             "crop_total": crop_tool,
                             "gg_duration_total": gg_duration,
-                            "voice": voice
+                            "voice": voice,
+                            "tags":tags
                         }
                         processed_list.append(json.dumps(number_dict, ensure_ascii=False))
                         if channel_id == "抖音" or channel_id == "快手" or channel_id == "视频号":
@@ -339,7 +347,8 @@ class Material():
                                     "video_ending": video_ending,
                                     "crop_total": crop_tool,
                                     "gg_duration_total": gg_duration,
-                                    "voice": voice
+                                    "voice": voice,
+                                    "tags": tags
                                 }
                                 processed_list.append(json.dumps(number_dict, ensure_ascii=False))
                 else:

+ 1 - 1
data_channel/douyin.py

@@ -48,7 +48,7 @@ class DY:
                 s = requests.session()
                 s.mount('http://', HTTPAdapter(max_retries=3))
                 s.mount('https://', HTTPAdapter(max_retries=3))
-                response = requests.request(method='GET', url=url, headers=headers, params=query)
+                response = requests.request(method='GET', url=url, headers=headers, params=query, timeout=30)
                 body = response.content.decode()
                 obj = json.loads(body)
                 has_more = True if obj.get('has_more', 0) == 1 else False

+ 1 - 1
data_channel/dy_keyword.py

@@ -45,7 +45,7 @@ class DyKeyword:
             special = 0.15
             short_duration_rule = 25
         try:
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
             response = response.json()
             code = response['code']
             if code != 0:

+ 3 - 3
data_channel/dy_ls.py

@@ -14,7 +14,7 @@ class DYLS:
         url = "http://47.236.68.175:8889/crawler/dou_yin/blogger"
         list = []
         next_cursor = ''
-        for i in range(20):
+        for i in range(5):
             try:
                 payload = json.dumps({
                     "account_id": url_id,
@@ -26,7 +26,7 @@ class DYLS:
                     'Content-Type': 'application/json'
                 }
 
-                response = requests.request("POST", url, headers=headers, data=payload)
+                response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
                 time.sleep(random.randint(1, 5))
                 response = response.json()
                 code = response['code']
@@ -174,7 +174,7 @@ class DYLS:
                 'Content-Type': 'application/json'
             }
 
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
             response = response.json()
             code = response["code"]
             if code == 10000:

+ 2 - 2
data_channel/ks_keyword.py

@@ -51,7 +51,7 @@ class KsKeyword:
             short_duration_rule = 25
         try:
             time.sleep(3)
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
             response = response.json()
             code = response['code']
             if code != 0:
@@ -128,7 +128,7 @@ class KsKeyword:
             'Content-Type': 'application/json'
         }
 
-        response = requests.request("POST", url, headers=headers, data=payload)
+        response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
         response = response.json()
         data = response["data"]["data"]
         video_url = data["video_url_list"][0]["video_url"]

+ 3 - 3
data_channel/ks_ls.py

@@ -13,7 +13,7 @@ class KSLS:
         url = "http://47.236.68.175:8889/crawler/kuai_shou/blogger"
         next_cursor = ""
         try:
-            for i in range(20):
+            for i in range(5):
                 payload = json.dumps({
                     "account_id": url_id,
                     "sort_type": "最热",
@@ -23,7 +23,7 @@ class KSLS:
                     'Content-Type': 'application/json'
                 }
                 time.sleep(random.randint(1, 5))
-                response = requests.request("POST", url, headers=headers, data=payload)
+                response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
                 response = response.json()
                 list = []
                 data_all_list = response["data"]
@@ -108,7 +108,7 @@ class KSLS:
             'Content-Type': 'application/json'
         }
 
-        response = requests.request("POST", url, headers=headers, data=payload)
+        response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
         response = response.json()
         data = response["data"]["data"]
         video_url = data["video_url_list"][0]["video_url"]

+ 1 - 1
data_channel/kuaishou.py

@@ -25,7 +25,7 @@ class KS:
         for i in range(5):
             try:
                 time.sleep(2)
-                response = requests.request("POST", url, headers=headers, data=payload)
+                response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
                 response = response.json()
                 if response["code"] == 0:
                     data = response["data"]["data"]

+ 1 - 1
data_channel/shipinhao.py

@@ -73,7 +73,7 @@ class SPH:
                 "cursor": next_cursor
             })
             try:
-                response = requests.request("POST", url, headers=headers, data=payload)
+                response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
                 time.sleep(random.randint(1, 5))
                 res_json = response.json()
                 if res_json['code'] == 0:

+ 2 - 2
data_channel/sph_keyword.py

@@ -32,14 +32,14 @@ class SphKeyword:
         }
         try:
             time.sleep(1)
-            response = requests.request("POST", url, headers=headers, data=payload)
+            response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
             response = response.json()
             code = response['code']
             if code != 0:
                 Feishu.finish_bot(f"shi_pin_hao/keyword {response['msg']}",
                                   "https://open.feishu.cn/open-apis/bot/v2/hook/575ca6a1-84b4-4a2f-983b-1d178e7b16eb",
                                   "【视频号搜索接口使用提示】")
-                Common.logger("sph-key-word").info(f"快手搜索词数据获取失败,{response['msg']}\n")
+                Common.logger("sph-key-word").info(f"视频号搜索词数据获取失败,{response['msg']}\n")
                 return list
             data_list = response['data']['data']
             for data in data_list:

+ 15 - 12
video_rewriting/video_processor.py

@@ -101,6 +101,7 @@ class VideoProcessor:
             crop_total = task["crop_total"]
             gg_duration_total = task["gg_duration_total"]
             voice = task['voice']
+            tags = task['tags']
             if voice:
                 if ',' in voice:
                     voices = voice.split(',')
@@ -383,6 +384,8 @@ class VideoProcessor:
                         Feishu.finish_bot(text,
                                           "https://open.feishu.cn/open-apis/bot/v2/hook/e7697dc6-5254-4411-8b59-3cd0742bf703",
                                           "【 机器改造通知 】")
+                        if tags:
+                            Tag.video_tag(code, tags)
                         if values:
                             if name == "王雪珂":
                                 sheet = "vfhHwj"
@@ -670,18 +673,18 @@ class VideoProcessor:
             return
         task = json.loads(data)
         try:
-            if mark == 'dy-pl-gjc' and task['channel_id'] == '抖音搜索':
-                mark_count = 'dyss-count'
-                count = get_first_value_with_prefix(mark_count)
-                increment_key(mark_count)
-                if int(count) >= 300:
-                    return "抖音搜索上限"
-            if mark == 'ks-pl-gjc':
-                mark_count = 'ksss-count'
-                count = get_first_value_with_prefix(mark_count)
-                increment_key(mark_count)
-                if int(count) >= 300:
-                    return "快手搜索上限"
+            # if mark == 'dy-pl-gjc' and task['channel_id'] == '抖音搜索':
+            #     mark_count = 'dyss-count'
+            #     count = get_first_value_with_prefix(mark_count)
+            #     increment_key(mark_count)
+            #     if int(count) >= 300:
+            #         return "抖音搜索上限"
+            # if mark == 'ks-pl-gjc':
+            #     mark_count = 'ksss-count'
+            #     count = get_first_value_with_prefix(mark_count)
+            #     increment_key(mark_count)
+            #     if int(count) >= 300:
+            #         return "快手搜索上限"
             if mark == 'sph-pl-gjc':
                 mark_count = 'ss-sph-count'
                 count = get_first_value_with_prefix(mark_count)