|
@@ -4,9 +4,6 @@
|
|
|
from datetime import datetime, timedelta
|
|
|
|
|
|
import requests
|
|
|
-import json
|
|
|
-import oss2
|
|
|
-from uuid import uuid4
|
|
|
|
|
|
|
|
|
def generate_daily_strings(start_date, end_date):
|
|
@@ -66,129 +63,3 @@ def get_text(video_id):
|
|
|
headers=header
|
|
|
)
|
|
|
return response.json()
|
|
|
-
|
|
|
-
|
|
|
-def auto_upload_aigc():
|
|
|
- """
|
|
|
- auto publish
|
|
|
- :return:
|
|
|
- """
|
|
|
- url = "http://aigc-api.cybertogether.net/aigc/crawler/plan/save"
|
|
|
-
|
|
|
- payload = json.dumps({
|
|
|
- "params": {
|
|
|
- "contentFilters": [],
|
|
|
- "accountFilters": [],
|
|
|
- "filterAccountMatchMode": 1,
|
|
|
- "filterContentMatchMode": 1,
|
|
|
- "selectModeValues": [],
|
|
|
- "imageSearchModeValues": [],
|
|
|
- "contentModal": 3,
|
|
|
- "analyze": {},
|
|
|
- "crawlerComment": 0,
|
|
|
- "inputGroup": [
|
|
|
- [
|
|
|
- {
|
|
|
- "inputValue": [
|
|
|
- {
|
|
|
- "fileName": "pqzf.png",
|
|
|
- "ossKey": "upload/03bf695277827c2387133a1ac9290fd2.png",
|
|
|
- "type": "image/png",
|
|
|
- "size": 2978
|
|
|
- }
|
|
|
- ],
|
|
|
- "fieldName": "cover",
|
|
|
- "fieldType": 1,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28"
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "title",
|
|
|
- "fieldType": 0,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28",
|
|
|
- "inputValue": "412412412"
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "content",
|
|
|
- "fieldType": 0,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28",
|
|
|
- "inputValue": "12312442"
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "image",
|
|
|
- "fieldType": 1,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28",
|
|
|
- "inputValue": [
|
|
|
- {
|
|
|
- "fileName": "lehuo.png",
|
|
|
- "ossKey": "upload/4bf6db57ccd1629909e070833aab8878.png",
|
|
|
- "type": "image/png",
|
|
|
- "size": 5085
|
|
|
- }
|
|
|
- ]
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "video",
|
|
|
- "fieldType": 2,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28"
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "audio",
|
|
|
- "fieldType": 3,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28"
|
|
|
- },
|
|
|
- {
|
|
|
- "fieldName": "tag",
|
|
|
- "fieldType": 0,
|
|
|
- "groupId": "fa9557a13208975a893777188f9e4b28"
|
|
|
- }
|
|
|
- ]
|
|
|
- ],
|
|
|
- "inputSourceGroups": [],
|
|
|
- "modePublishTime": [],
|
|
|
- "name": "junhui测试自动上传_by_python",
|
|
|
- "frequencyType": 3,
|
|
|
- "planType": 2
|
|
|
- },
|
|
|
- "baseInfo": {
|
|
|
- "token": "af54cdc404c3464d896745df389b2dce",
|
|
|
- "appType": 9,
|
|
|
- "platform": "pc",
|
|
|
- "appVersionCode": 1000,
|
|
|
- "clientTimestamp": 1,
|
|
|
- "fid": 1,
|
|
|
- "loginUid": 1,
|
|
|
- "pageSource": 1,
|
|
|
- "requestId": 1,
|
|
|
- "rid": 1,
|
|
|
- "uid": 1
|
|
|
- }
|
|
|
- })
|
|
|
- headers = {
|
|
|
- 'Accept': 'application/json',
|
|
|
- 'Accept-Language': 'en,zh;q=0.9,zh-CN;q=0.8',
|
|
|
- 'Content-Type': 'application/json',
|
|
|
- 'Origin': 'http://aigc-admin.cybertogether.net',
|
|
|
- 'Proxy-Connection': 'keep-alive',
|
|
|
- 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/125.0.0.0 Safari/537.36'
|
|
|
- }
|
|
|
-
|
|
|
- response = requests.request("POST", url, headers=headers, data=payload)
|
|
|
-
|
|
|
- print(response.text)
|
|
|
-
|
|
|
-
|
|
|
-def upload_to_oss(local_path):
|
|
|
- """
|
|
|
- 上传到oss
|
|
|
- :return:
|
|
|
- """
|
|
|
- oss_video_key = str(uuid4())
|
|
|
- access_key_id = "LTAIP6x1l3DXfSxm"
|
|
|
- access_key_secret = "KbTaM9ars4OX3PMS6Xm7rtxGr1FLon"
|
|
|
- endpoint = "oss-cn-hangzhou.aliyuncs.com"
|
|
|
- bucket_name = "art-pubbucket"
|
|
|
- bucket = oss2.Bucket(
|
|
|
- oss2.Auth(access_key_id, access_key_secret), endpoint, bucket_name
|
|
|
- )
|
|
|
- bucket.put_object_from_file(key=oss_video_key, filename=local_path)
|
|
|
- return oss_video_key
|