habulaj commited on
Commit
6f6d112
·
verified ·
1 Parent(s): 4d4d42d

Update main.py

Browse files
Files changed (1) hide show
  1. main.py +20 -5
main.py CHANGED
@@ -1181,11 +1181,20 @@ async def publish_girlsmoodaily_endpoint():
1181
  if publish_message and not record.get("published", False):
1182
  print(f"🔄 Post #{record_id} já possui publish_message. Tentando publicar direto no Instagram...")
1183
  try:
1184
- head_resp = requests.head(final_content_url, timeout=15)
1185
- content_type = head_resp.headers.get('content-type', '').lower()
1186
- is_video = 'image' not in content_type
1187
-
1188
  r0 = result_data[0] if isinstance(result_data, list) and len(result_data) > 0 else {}
 
 
 
 
 
 
 
 
 
 
 
 
 
1189
  caption_text = r0.get("description", "")
1190
 
1191
  publish_payload = {
@@ -1291,7 +1300,13 @@ RESULTADO GERADO PARA A POSTAGEM (o texto que vai pro ar com o post):
1291
  - Tipo: {r0.get('result_type', 'N/A')}
1292
  """
1293
 
1294
- is_video = 'image' not in content_type
 
 
 
 
 
 
1295
 
1296
  prompt = f"""Você é AMANDA, a Gestora de Distribuição da @girlsmoodaily no Instagram.
1297
 
 
1181
  if publish_message and not record.get("published", False):
1182
  print(f"🔄 Post #{record_id} já possui publish_message. Tentando publicar direto no Instagram...")
1183
  try:
 
 
 
 
1184
  r0 = result_data[0] if isinstance(result_data, list) and len(result_data) > 0 else {}
1185
+
1186
+ post_type = record.get("type", "")
1187
+ if post_type == "video":
1188
+ is_video = True
1189
+ elif post_type == "image":
1190
+ is_video = False
1191
+ elif r0.get("result_type") == "meme":
1192
+ is_video = False
1193
+ else:
1194
+ head_resp = requests.head(final_content_url, allow_redirects=True, timeout=15)
1195
+ content_type = head_resp.headers.get('content-type', '').lower()
1196
+ is_video = 'image' not in content_type
1197
+
1198
  caption_text = r0.get("description", "")
1199
 
1200
  publish_payload = {
 
1300
  - Tipo: {r0.get('result_type', 'N/A')}
1301
  """
1302
 
1303
+ post_type = record.get("type", "")
1304
+ if post_type == "video":
1305
+ is_video = True
1306
+ elif post_type == "image":
1307
+ is_video = False
1308
+ else:
1309
+ is_video = 'image' not in content_type
1310
 
1311
  prompt = f"""Você é AMANDA, a Gestora de Distribuição da @girlsmoodaily no Instagram.
1312