File size: 2,416 Bytes
535fdb1
afcc1ad
 
 
 
 
535fdb1
afcc1ad
535fdb1
 
afcc1ad
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
title: Automated AI Video & Social Media Publisher (n8n converted)
emoji: 🚀
colorFrom: purple
colorTo: indigo
sdk: gradio # Or 'gradio' if you choose to use Gradio for your UI
app_file: app.py
python_version: "3.10" # Or 3.9, 3.11, etc., as per your preference and compatibility
---

# Automated AI Video & Social Media Publisher

This Hugging Face Space automates the process of creating AI avatar videos and publishing them to social media. It is a direct Python conversion of an n8n workflow.

## How it Works

The workflow performs the following steps:

1.  **News Research (Hacker News)**: Fetches the top 10 AI/LLM-related stories from Hacker News and selects the most viral one.
2.  **Script Generation (OpenAI)**: Generates a 30-second monologue script for an AI avatar video based on the selected news story and comments.
3.  **Caption Generation (OpenAI)**: Creates both long and short captions for social media posts.
4.  **AI Video Creation (Heygen)**: Uses the generated script to create an AI avatar video.
5.  **Media Upload (Blotato)**: Uploads the generated video to Blotato's media library.
6.  **Social Media Publishing (Blotato)**: Publishes the video and captions to various social media platforms (currently YouTube is enabled in the Python code, others are disabled as per the n8n workflow).

## Setup & Secrets

To run this Space, you **must** set the following environment variables as **Space Secrets** in the "Settings" tab of your Hugging Face Space:

* `OPENAI_API_KEY`: Your OpenAI API key.
* `HEYGEN_API_KEY`: Your Heygen API key (a paid Heygen plan is required for video generation, as the free plan is insufficient).
* `BLOTATO_API_KEY`: Your Blotato API key.

**Optional Environment Variables (set if different from defaults or dynamic):**

* `HEYGEN_AVATAR_ID` (Default: `c67f3f55c5fd49d080e19a2ea9666e77`)
* `HEYGEN_VOICE_ID` (Default: `e515d746526f448fa533afddc97e4933`)
* `HEYGEN_BACKGROUND_VIDEO_URL` (Default: `https://database.blotato.io/storage/v1/object/public/public_media/4ddd33eb-e811-4ab5-93e1-2cd0b7e8fb3f/videogen2-render-e6b398a2-5859-4a77-88ef-2345bcefdc98.mp4`)
* `BLOTATO_INSTAGRAM_ID`
* `BLOTATO_YOUTUBE_ID` (Default: `5174`)
* `BLOTATO_TIKTOK_ID`
* `BLOTATO_FACEBOOK_ID`
* `BLOTATO_FACEBOOK_PAGE_ID`
* `BLOTATO_THREADS_ID`
* `BLOTATO_TWITTER_ID`
* `BLOTATO_LINKEDIN_ID`
* `BLOTATO_PINTEREST_ID`
* `BLOTATO_PINTEREST_BOARD_ID`
* `BLOTATO_BLUESKY_ID`

---