async function main({ params }: Args): Promise<Output> {
// 1. Get the body string from params.input
// Note: Here we assume params.input is the entire HTTP response object
const bodyStr = params.input;
// 2. Parse the string format body into a JSON object
// Since the value of body is a string "{\"id\":...}", JSON.parse is needed
let taskId = "";
try {
const bodyObj = JSON.parse(bodyStr);
taskId = bodyObj.id;
} catch (e) {
// Prevent parsing failure from causing runtime errors
console.log("JSON parsing failed:", e);
}
// 3. Build the output object and return taskId
const ret = {
"taskId": taskId
};
return ret;
}async function main({ params }: Args): Promise<Output> {
// 1. Get the body string from params.input
const bodyStr = params.input;
// 2. Parse the string format body into a JSON object
let url = "";
let status = "";
try {
const bodyObj = JSON.parse(bodyStr);
url = bodyObj.video_url;
status = bodyObj.status;
} catch (e) {
// Prevent parsing failure from causing runtime errors
console.log("JSON parsing failed:", e);
}
// 3. Build the output object and return taskId
const ret = {
"url": url,
"status": status
};
return ret;
}async function main({ params }: Args): Promise<Output> {
// Get the input
const urls = params.urls;
const statuss = params.statuss;
// 3. Build the output object and return taskId
const ret = {
"url": urls[urls?.length -1],
"status": statuss[statuss?.length -1]
};
return ret;
}