|
@@ -2,7 +2,7 @@ import random
|
|
|
import time
|
|
|
import requests
|
|
|
import json
|
|
|
-from common import Feishu, AliyunLogger
|
|
|
+from common import Feishu, AliyunLogger, Material
|
|
|
from common.sql_help import sqlCollect
|
|
|
|
|
|
class KSLS:
|
|
@@ -10,11 +10,12 @@ class KSLS:
|
|
|
@classmethod
|
|
|
def get_ksls_list(cls, task_mark, url_id, number, mark, channel_id, name):
|
|
|
# 快手app
|
|
|
+ list = []
|
|
|
url = "http://8.217.192.46:8889/crawler/kuai_shou/blogger"
|
|
|
next_cursor = ""
|
|
|
try:
|
|
|
- if not url_id:
|
|
|
- return
|
|
|
+ if not url_id or not url_id.strip():
|
|
|
+ return list
|
|
|
for i in range(5):
|
|
|
payload = json.dumps({
|
|
|
"account_id": url_id,
|
|
@@ -27,7 +28,7 @@ class KSLS:
|
|
|
time.sleep(random.randint(1, 5))
|
|
|
response = requests.request("POST", url, headers=headers, data=payload, timeout=30)
|
|
|
response = response.json()
|
|
|
- list = []
|
|
|
+
|
|
|
data_all_list = response["data"]
|
|
|
if data_all_list == None or len(data_all_list) == 0:
|
|
|
try:
|
|
@@ -43,7 +44,12 @@ class KSLS:
|
|
|
data_list = data_all_list["data"]
|
|
|
for data in data_list:
|
|
|
photo_id = data["photo_id"]
|
|
|
- status = sqlCollect.is_used(task_mark, photo_id, mark, "快手历史")
|
|
|
+ day_count = Material.get_count_restrict(channel_id)
|
|
|
+ if day_count:
|
|
|
+ status = sqlCollect.is_used_days(task_mark, photo_id, mark, "快手历史", day_count)
|
|
|
+ else:
|
|
|
+
|
|
|
+ status = sqlCollect.is_used(task_mark, photo_id, mark, "快手历史")
|
|
|
|
|
|
view_count = data["view_count"]
|
|
|
share_count = data["share_count"]
|
|
@@ -56,9 +62,9 @@ class KSLS:
|
|
|
log_data = f"user:{url_id},,video_id:{photo_id},,video_url:'',original_title:{old_title},,share_count:{share_count},,view_count:{view_count},,duration:{duration}"
|
|
|
|
|
|
AliyunLogger.logging(channel_id, name, url_id, photo_id, "扫描到一条视频", "2001", log_data)
|
|
|
- # if status:
|
|
|
- # AliyunLogger.logging(channel_id, name, url_id, photo_id, "该视频已改造过", "2002", log_data)
|
|
|
- # continue
|
|
|
+ if status:
|
|
|
+ AliyunLogger.logging(channel_id, name, url_id, photo_id, "该视频已改造过", "2002", log_data)
|
|
|
+ continue
|
|
|
if float(video_percent) < special:
|
|
|
AliyunLogger.logging(channel_id, name, url_id, photo_id, "不符合规则:分享/浏览小于0.0005", "2003", log_data)
|
|
|
continue
|