|  | @@ -8,12 +8,71 @@ import requests
 | 
	
		
			
				|  |  |  from uuid import uuid4
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -def auto_upload_aigc(title, text, img_list):
 | 
	
		
			
				|  |  | +def process_obj(obj):
 | 
	
		
			
				|  |  |      """
 | 
	
		
			
				|  |  | -    auto publish
 | 
	
		
			
				|  |  | +    title, text, img_list, group_id
 | 
	
		
			
				|  |  |      :return:
 | 
	
		
			
				|  |  |      """
 | 
	
		
			
				|  |  |      group_id = str(uuid4()).replace("-", "")
 | 
	
		
			
				|  |  | +    title = obj['title']
 | 
	
		
			
				|  |  | +    text = obj['text']
 | 
	
		
			
				|  |  | +    img_list = obj['img_list']
 | 
	
		
			
				|  |  | +    temp = [
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "inputValue": [
 | 
	
		
			
				|  |  | +                {
 | 
	
		
			
				|  |  | +                    "fileName": "pqzf.png",
 | 
	
		
			
				|  |  | +                    "ossKey": "upload/03bf695277827c2387133a1ac9290fd2.png",
 | 
	
		
			
				|  |  | +                    "type": "image/png",
 | 
	
		
			
				|  |  | +                    "size": 2978
 | 
	
		
			
				|  |  | +                }
 | 
	
		
			
				|  |  | +            ],
 | 
	
		
			
				|  |  | +            "fieldName": "cover",
 | 
	
		
			
				|  |  | +            "fieldType": 1,
 | 
	
		
			
				|  |  | +            "groupId": group_id
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "title",
 | 
	
		
			
				|  |  | +            "fieldType": 0,
 | 
	
		
			
				|  |  | +            "groupId": group_id,
 | 
	
		
			
				|  |  | +            "inputValue": title
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "content",
 | 
	
		
			
				|  |  | +            "fieldType": 0,
 | 
	
		
			
				|  |  | +            "groupId": group_id,
 | 
	
		
			
				|  |  | +            "inputValue": text
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "image",
 | 
	
		
			
				|  |  | +            "fieldType": 1,
 | 
	
		
			
				|  |  | +            "groupId": group_id,
 | 
	
		
			
				|  |  | +            "inputValue": img_list
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "video",
 | 
	
		
			
				|  |  | +            "fieldType": 2,
 | 
	
		
			
				|  |  | +            "groupId": group_id
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "audio",
 | 
	
		
			
				|  |  | +            "fieldType": 3,
 | 
	
		
			
				|  |  | +            "groupId": group_id
 | 
	
		
			
				|  |  | +        },
 | 
	
		
			
				|  |  | +        {
 | 
	
		
			
				|  |  | +            "fieldName": "tag",
 | 
	
		
			
				|  |  | +            "fieldType": 0,
 | 
	
		
			
				|  |  | +            "groupId": group_id
 | 
	
		
			
				|  |  | +        }
 | 
	
		
			
				|  |  | +    ]
 | 
	
		
			
				|  |  | +    return temp
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +def auto_upload_aigc(task_name, obj_list):
 | 
	
		
			
				|  |  | +    """
 | 
	
		
			
				|  |  | +    auto publish
 | 
	
		
			
				|  |  | +    :return:
 | 
	
		
			
				|  |  | +    """
 | 
	
		
			
				|  |  |      url = "http://aigc-api.cybertogether.net/aigc/crawler/plan/save"
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |      payload = json.dumps({
 | 
	
	
		
			
				|  | @@ -28,58 +87,11 @@ def auto_upload_aigc(title, text, img_list):
 | 
	
		
			
				|  |  |              "analyze": {},
 | 
	
		
			
				|  |  |              "crawlerComment": 0,
 | 
	
		
			
				|  |  |              "inputGroup": [
 | 
	
		
			
				|  |  | -                [
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "inputValue": [
 | 
	
		
			
				|  |  | -                            {
 | 
	
		
			
				|  |  | -                                "fileName": "pqzf.png",
 | 
	
		
			
				|  |  | -                                "ossKey": "upload/03bf695277827c2387133a1ac9290fd2.png",
 | 
	
		
			
				|  |  | -                                "type": "image/png",
 | 
	
		
			
				|  |  | -                                "size": 2978
 | 
	
		
			
				|  |  | -                            }
 | 
	
		
			
				|  |  | -                        ],
 | 
	
		
			
				|  |  | -                        "fieldName": "cover",
 | 
	
		
			
				|  |  | -                        "fieldType": 1,
 | 
	
		
			
				|  |  | -                        "groupId": group_id
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "title",
 | 
	
		
			
				|  |  | -                        "fieldType": 0,
 | 
	
		
			
				|  |  | -                        "groupId": group_id,
 | 
	
		
			
				|  |  | -                        "inputValue": title
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "content",
 | 
	
		
			
				|  |  | -                        "fieldType": 0,
 | 
	
		
			
				|  |  | -                        "groupId": group_id,
 | 
	
		
			
				|  |  | -                        "inputValue": text
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "image",
 | 
	
		
			
				|  |  | -                        "fieldType": 1,
 | 
	
		
			
				|  |  | -                        "groupId": group_id,
 | 
	
		
			
				|  |  | -                        "inputValue": img_list
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "video",
 | 
	
		
			
				|  |  | -                        "fieldType": 2,
 | 
	
		
			
				|  |  | -                        "groupId": group_id
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "audio",
 | 
	
		
			
				|  |  | -                        "fieldType": 3,
 | 
	
		
			
				|  |  | -                        "groupId": group_id
 | 
	
		
			
				|  |  | -                    },
 | 
	
		
			
				|  |  | -                    {
 | 
	
		
			
				|  |  | -                        "fieldName": "tag",
 | 
	
		
			
				|  |  | -                        "fieldType": 0,
 | 
	
		
			
				|  |  | -                        "groupId": group_id
 | 
	
		
			
				|  |  | -                    }
 | 
	
		
			
				|  |  | -                ]
 | 
	
		
			
				|  |  | +                process_obj(obj) for obj in obj_list
 | 
	
		
			
				|  |  |              ],
 | 
	
		
			
				|  |  |              "inputSourceGroups": [],
 | 
	
		
			
				|  |  |              "modePublishTime": [],
 | 
	
		
			
				|  |  | -            "name": title,
 | 
	
		
			
				|  |  | +            "name": task_name,
 | 
	
		
			
				|  |  |              "frequencyType": 3,
 | 
	
		
			
				|  |  |              "planType": 2
 | 
	
		
			
				|  |  |          },
 | 
	
	
		
			
				|  | @@ -106,7 +118,6 @@ def auto_upload_aigc(title, text, img_list):
 | 
	
		
			
				|  |  |          '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)
 | 
	
		
			
				|  |  |      return response.json()
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  
 |