|
@@ -137,7 +137,33 @@ class AutoReplyCardsMonitorUtils:
|
|
|
return video_id, root_source_id
|
|
return video_id, root_source_id
|
|
|
|
|
|
|
|
@staticmethod
|
|
@staticmethod
|
|
|
- async def get_cover_url(aes_key, total_size, file_id):
|
|
|
|
|
|
|
+ async def get_cover_url(aes_key, file_id):
|
|
|
|
|
+ url = "https://wechat-protocol.aiddit.com/xed/getCdnUrl"
|
|
|
|
|
+ data = {
|
|
|
|
|
+ "file_id": file_id,
|
|
|
|
|
+ "aes_key": aes_key
|
|
|
|
|
+ }
|
|
|
|
|
+ headers = {
|
|
|
|
|
+ "Content-Type": "application/json",
|
|
|
|
|
+ }
|
|
|
|
|
+ try:
|
|
|
|
|
+ async with AsyncHttpClient() as client:
|
|
|
|
|
+ response = await client.post(
|
|
|
|
|
+ url, headers=headers, data=json.dumps(data)
|
|
|
|
|
+ )
|
|
|
|
|
+ if response and response.get("status") != 0:
|
|
|
|
|
+ print(f"[ERROR] get_cover_url API error: status={response.get('status')}, msg={response.get('msg')}")
|
|
|
|
|
+ return None
|
|
|
|
|
+ return response
|
|
|
|
|
+ except Exception as e:
|
|
|
|
|
+ print(f"[ERROR] get_cover_url failed: {e}")
|
|
|
|
|
+ return None
|
|
|
|
|
+
|
|
|
|
|
+ @staticmethod
|
|
|
|
|
+ async def get_cover_url_old(aes_key, total_size, file_id):
|
|
|
|
|
+ """
|
|
|
|
|
+ gewe API 暂时失效
|
|
|
|
|
+ """
|
|
|
url = "http://api.geweapi.com/gewe/v2/api/message/downloadCdn"
|
|
url = "http://api.geweapi.com/gewe/v2/api/message/downloadCdn"
|
|
|
data = {
|
|
data = {
|
|
|
"appId": "wx_anFlUnezoUynU3SKcqTWk",
|
|
"appId": "wx_anFlUnezoUynU3SKcqTWk",
|
|
@@ -201,7 +227,7 @@ class AutoReplyCardsMonitorUtils:
|
|
|
@staticmethod
|
|
@staticmethod
|
|
|
def download_cover(file_name, cover_obj, timeout=10):
|
|
def download_cover(file_name, cover_obj, timeout=10):
|
|
|
try:
|
|
try:
|
|
|
- cover_url = cover_obj["data"]["fileUrl"]
|
|
|
|
|
|
|
+ cover_url = cover_obj["oss_object"]["cdn_url"]
|
|
|
except (KeyError, TypeError):
|
|
except (KeyError, TypeError):
|
|
|
print(f"[WARN] Invalid cover_obj structure: {cover_obj}")
|
|
print(f"[WARN] Invalid cover_obj structure: {cover_obj}")
|
|
|
return None
|
|
return None
|