|
@@ -1,5 +1,5 @@
|
|
|
import requests
|
|
|
-from utils.UrlConfig import headers, refresh_video_url
|
|
|
+from utils.UrlConfig import headers
|
|
|
import json
|
|
|
import pandas as pd
|
|
|
import datetime
|
|
@@ -109,23 +109,30 @@ def get_history_video_info(account_id, url, start_time, end_time, video_cnt, rel
|
|
|
return request_json
|
|
|
|
|
|
|
|
|
+def refresh_video(account_id, url):
|
|
|
+ """
|
|
|
+ 需要调用刷新快手素材的接口 http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getKuaiShouVideoList
|
|
|
+ (请求方式 POST 入参:accountId 返回结果:成功或失败)
|
|
|
+ remark: 自动上新之前,需要调用该接口,注意是账户层级的调用,不是app_id层级的调用
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ request = requests.post(url=url, headers=headers,
|
|
|
+ data=json.JSONEncoder().encode({"accountId": account_id})).text
|
|
|
+ request_json = json.loads(request)
|
|
|
+ logger.info('account_id=%s, the res of getKuaiShouVideoList is %s' % (account_id, request_json))
|
|
|
+ except Exception:
|
|
|
+ logger.error('account_id=%s, the res of getKuaiShouVideoList is %s, traceback is %s ' %
|
|
|
+ (account_id, request, traceback.format_exc()))
|
|
|
+
|
|
|
+
|
|
|
def get_new_video_info(account_id, url, app_version=None):
|
|
|
"""
|
|
|
url:http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getNewVideoList
|
|
|
请求方式:POST
|
|
|
remark:
|
|
|
1、返回 upload_time 在上次调用时间到本次调用时间内的素材(第一次调用返回5分钟前到本次调用时间的素材)
|
|
|
- 2、需要调用刷新快手素材的接口 http://192.168.1.8:8080/jeecg-boot/kuaishou/material/getKuaiShouVideoList
|
|
|
- (请求方式 POST 入参:accountId 返回结果:成功或失败)
|
|
|
入参:accountId
|
|
|
"""
|
|
|
- try:
|
|
|
- request = requests.post(url=refresh_video_url, headers=headers,
|
|
|
- data=json.JSONEncoder().encode({"accountId": account_id})).text
|
|
|
- _ = json.loads(request)
|
|
|
- except Exception:
|
|
|
- logger.error('account_id=%s, app_version=%s, the res of getKuaiShouVideoList is %s, traceback is %s ' %
|
|
|
- (account_id, app_version, request, traceback.format_exc()))
|
|
|
|
|
|
if not app_version:
|
|
|
request_data = {"accountId": account_id}
|