Discussions
The result of getting a specific talk
I use vscode to write api code, but the json result of get a specific talk does not have result_url, but pending_url. How can I solve this problem?
Here is my code:
import requests
import json
import base64
import requests
url = "https://api.d-id.com/talks"
auth_string = "My_Api_Key"
base64_auth_string = base64.b64encode(auth_string.encode()).decode()
payload = {
"script": {
"type": "text",
"provider": {
"type": "microsoft",
"voice_id": "en-US-JennyNeural"
},
"input": "Hello I am a girl."
},
"source_url": "https://create-images-results.d-id.com/api_docs/assets/noelle.jpeg"
}
headers = {
"accept": "application/json",
"content-type": "application/json",
"authorization": f"Basic {base64_auth_string}"
}
response = requests.post(url, json=payload, headers=headers)
response_json = json.loads(response.text)
print(response_json)
talk_id = response_json['id']
status = response_json['status']
return talk_id, status
get talk
url = "https://api.d-id.com/talks/"+talk_id
auth_string = "My_Api_Key"
base64_auth_string = base64.b64encode(auth_string.encode()).decode()
print(base64_auth_string)
headers = {
"accept": "application/json",
"Authorization": f"Basic {base64_auth_string}"
}
response = requests.get(url, headers=headers)
print(response.text)
here is my result:
{"user":{"features":["stitch","clips:write",null],"id":"google-oauth2|100425289038350450699","plan":"deid-trial","authorizer":"basic","email":"[email protected]","owner_id":"google-oauth2|100425289038350450699"},"script":{"length":18,"ssml":false,"subtitles":false,"type":"text","provider":{"type":"microsoft","voice_id":"en-US-JennyNeural"}},"audio_url":"https://d-id-talks-prod.s3.us-west-2.amazonaws.com/google-oauth2%7C100425289038350450699/tlk_kTXAILHnsBZA2k8IyDLfM/microsoft.wav?AWSAccessKeyId=AKIA5CUMPJBIK65W6FGA&Expires=1690816652&Signature=FGFOS6zP9oeiq%2FVEC6cO9N1FuCw%3D&X-Amzn-Trace-Id=Root%3D1-64c67f0b-56b6f8641e366a495d173236%3BParent%3D1d7aa7ad0335fcb5%3BSampled%3D0%3BLineage%3Da08e19fe%3A0","created_at":"2023-07-30T15:17:32.916Z","config":{"logo":{"url":"d-id-logo","position":[0,0]},"result_format":".mp4"},"source_url":"https://d-id-talks-prod.s3.us-west-2.amazonaws.com/google-oauth2%7C100425289038350450699/tlk_kTXAILHnsBZA2k8IyDLfM/source/noelle.jpeg?AWSAccessKeyId=AKIA5CUMPJBIK65W6FGA&Expires=1690816652&Signature=ISAftTfGTp%2FhF436u0tw3v1qu%2FE%3D&X-Amzn-Trace-Id=Root%3D1-64c67f0b-56b6f8641e366a495d173236%3BParent%3D1d7aa7ad0335fcb5%3BSampled%3D0%3BLineage%3Da08e19fe%3A0","created_by":"google-oauth2|100425289038350450699","status":"created","driver_url":"bank://lively/","modified_at":"2023-07-30T15:17:32.916Z","user_id":"google-oauth2|100425289038350450699","subtitles":false,"id":"tlk_kTXAILHnsBZA2k8IyDLfM","duration":1.975,"pending_url":"s3://d-id-talks-prod/google-oauth2|100425289038350450699/tlk_kTXAILHnsBZA2k8IyDLfM/1690730252916.mp4"}