|
@@ -0,0 +1,78 @@
|
|
|
+from typing import Optional, Dict, List
|
|
|
+
|
|
|
+from applications.utils import AsyncHttPClient
|
|
|
+
|
|
|
+
|
|
|
+async def fetch_piaoquan_video_list_detail(video_list: List[int]) -> Optional[Dict]:
|
|
|
+ """async fetch piaoquan video detail"""
|
|
|
+ url = "https://longvideoapi.piaoquantv.com/longvideoapi/openapi/video/batchSelectVideoInfo"
|
|
|
+ data = {"videoIdList": video_list}
|
|
|
+ header = {
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ }
|
|
|
+ async with AsyncHttPClient() as client:
|
|
|
+ response = await client.post(url, json=data, headers=header)
|
|
|
+
|
|
|
+ return response
|
|
|
+
|
|
|
+
|
|
|
+async def change_video_audit_status(video_id: int, status_code: int = 5) -> Dict:
|
|
|
+ url = "https://admin.piaoquantv.com/manager/video/audit/v2/updateAuditStatus"
|
|
|
+ payload = "videoId={}&auditStatus={}&updateReasonJson=&rejectReasonJson=%5B%7B%22reason%22%3A%22%E9%95%BF%E6%96%87%E8%87%AA%E5%8A%A8%E4%B8%8B%E6%9E%B6%22%2C%22reasonId%22%3A-1%7D%5D&adminUid=206".format(
|
|
|
+ video_id, status_code
|
|
|
+ )
|
|
|
+ headers = {
|
|
|
+ "accept": "application/json",
|
|
|
+ "accept-language": "en,zh;q=0.9,zh-CN;q=0.8",
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ "cookie": "",
|
|
|
+ "origin": "https://admin.piaoquantv.com",
|
|
|
+ "priority": "u=1, i",
|
|
|
+ "sec-ch-ua": '"Not/A)Brand";v="8", "Chromium";v="126", "Google Chrome";v="126"',
|
|
|
+ "sec-ch-ua-mobile": "?0",
|
|
|
+ "sec-ch-ua-platform": '"macOS"',
|
|
|
+ "sec-fetch-dest": "empty",
|
|
|
+ "sec-fetch-mode": "cors",
|
|
|
+ "sec-fetch-site": "same-origin",
|
|
|
+ "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36",
|
|
|
+ }
|
|
|
+ async with AsyncHttPClient() as client:
|
|
|
+ response = await client.post(url, data=payload, headers=headers)
|
|
|
+
|
|
|
+ return response
|
|
|
+
|
|
|
+
|
|
|
+async def publish_video_to_piaoquan(oss_path: str, uid: str, title: str) -> Dict:
|
|
|
+ url = "https://vlogapi.piaoquantv.com/longvideoapi/crawler/video/send"
|
|
|
+ headers = {
|
|
|
+ "User-Agent": "PQSpeed/486 CFNetwork/1410.1 Darwin/22.6.0",
|
|
|
+ "cookie": "JSESSIONID=4DEA2B5173BB9A9E82DB772C0ACDBC9F; JSESSIONID=D02C334150025222A0B824A98B539B78",
|
|
|
+ "referer": "http://appspeed.piaoquantv.com",
|
|
|
+ "token": "524a8bc871dbb0f4d4717895083172ab37c02d2f",
|
|
|
+ "accept-language": "zh-CN,zh-Hans;q=0.9",
|
|
|
+ "Content-Type": "application/json",
|
|
|
+ }
|
|
|
+ payload = {
|
|
|
+ "deviceToken": "9ef064f2f7869b3fd67d6141f8a899175dddc91240971172f1f2a662ef891408",
|
|
|
+ "fileExtensions": "MP4",
|
|
|
+ "loginUid": uid,
|
|
|
+ "networkType": "Wi-Fi",
|
|
|
+ "platform": "iOS",
|
|
|
+ "requestId": "fb972cbd4f390afcfd3da1869cd7d001",
|
|
|
+ "sessionId": "362290597725ce1fa870d7be4f46dcc2",
|
|
|
+ "subSessionId": "362290597725ce1fa870d7be4f46dcc2",
|
|
|
+ "title": title,
|
|
|
+ "token": "524a8bc871dbb0f4d4717895083172ab37c02d2f",
|
|
|
+ "uid": uid,
|
|
|
+ "versionCode": "486",
|
|
|
+ "versionName": "3.4.12",
|
|
|
+ "videoFromScene": "1",
|
|
|
+ "videoPath": oss_path,
|
|
|
+ "viewStatus": "1",
|
|
|
+ "appType": 888888,
|
|
|
+ "repeatStatus": 1,
|
|
|
+ }
|
|
|
+ async with AsyncHttPClient() as client:
|
|
|
+ response = await client.post(url, data=payload, headers=headers)
|
|
|
+
|
|
|
+ return response
|