Generate post social media yang menarik dari artikel berita secara otomatis menggunakan AI.
- Gemini AI untuk ekstraksi konten dan headline generation
- AI Source Extraction - Gemini otomatis identifikasi nama media (bukan domain mentah)
- 5 Style Headline berbeda (Clickbait, Formal, Casual, Question, Storytelling)
- 2 Layout Design (White Box Classic & News Update Modern)
- Layout 1: White Box (Classic) - Clean dengan white overlay box
- Layout 2: News Update (Modern) - Badge + gradient overlay style
- Ukuran Instagram Portrait (1080x1350px) - langsung upload ready
- Auto image extraction dari artikel dengan multiple fallback
- Text wrapping otomatis untuk headline panjang
- Semua konfigurasi di config.py - no hardcoded values!
- Custom branding support (optional)
- Source attribution yang bisa di-toggle on/off
- Badge text customizable untuk Layout 2
- Warna dan spacing semuanya adjustable
- Web UI (Recommended) - Dark mode, responsive, real-time progress
- CLI - Untuk automation dan scripting
- Python API - Integrate ke aplikasi sendiri
pip install -r requirements.txt# Buat file .env
echo "GEMINI_API_KEY=your_api_key_here" > .envDapatkan API Key gratis di: https://ai.google.dev/
python app.pyBuka browser: http://localhost:5000
python headline_generator.py https://www.kompas.com/artikel-exampleWeb UI menyediakan interface yang mudah dengan fitur lengkap:
โจ Features:
- Dark mode interface yang modern dan clean
- Responsive design (mobile & desktop friendly)
- Real-time progress tracking saat generate
- Gallery untuk melihat semua hasil
- Settings panel untuk edit konfigurasi
- Simple mode: Sekali input API key, langsung generate
-
Setup API Key (pertama kali saja)
- Klik tab "Settings"
- Input Gemini API key
- Klik "Save API Key"
-
Generate Post
- Klik tab "Generate"
- Paste URL artikel berita
- Pilih Headline Style:
- ๐ฅ Clickbait - Sensational & viral
- ๐ฐ Formal - Professional & factual
- ๐ฌ Casual - Friendly & conversational
- โ Question - Engaging questions
- ๐ Storytelling - Narrative & emotional
- Pilih Layout Style:
- ๐ White Box (Classic)
- ๐จ News Update (Modern) - NEW!
- (Optional) Tambah brand text
- Klik "Generate Post"
-
Lihat Hasil di Gallery
- Klik tab "Gallery"
- Download atau delete hasil
- Badge "NEW" untuk post < 24 jam
Di tab Settings, kamu bisa customize:
- Image dimensions (Instagram Portrait/Square/Story, Twitter, dll)
- Font sizes dan typography
- Layout spacing (margin, padding, radius)
- AI temperature per style
- System prompts untuk tiap headline style (Advanced!)
- Source attribution settings
- Image extraction parameters
Dokumentasi lengkap: WEB_UI_GUIDE.md
python headline_generator.py <url> [options]-o, --output FILENAME Output filename custom
-b, --brand TEXT Brand text untuk branding
-s, --style STYLE Headline style (clickbait/formal/casual/question/storytelling)
-l, --layout LAYOUT Layout style (layout1/layout2)
--hide-source Hide source attribution
--show-source Show source attribution
-h, --help Show help message
# Generate dengan default settings (clickbait + layout1)
python headline_generator.py https://www.kompas.com/artikel
# Output akan di save ke: output/post_[title].png# Formal style untuk berita profesional
python headline_generator.py https://www.detik.com/artikel --style formal
# Casual style untuk konten santai
python headline_generator.py https://example.com/artikel -s casual
# Question style untuk engagement
python headline_generator.py https://example.com/artikel -s question# Layout 2 (News Update - Modern)
python headline_generator.py https://www.kompas.com/artikel --layout layout2
# Kombinasi style + layout
python headline_generator.py https://www.cnnindonesia.com/artikel \
--style clickbait \
--layout layout2# Tambah brand text
python headline_generator.py https://example.com/artikel --brand "MyBrand"
# Hide source attribution
python headline_generator.py https://example.com/artikel --hide-source
# Full combination
python headline_generator.py https://www.kompas.com/artikel \
--style formal \
--layout layout2 \
--brand "MyMedia" \
--show-source \
-o hasil_berita.pngHasil akan disimpan di folder output/ dengan format:
output/post_[judul-artikel].png
Setiap style punya karakteristik dan AI prompt yang berbeda:
Tujuan: Viral, sensational, curiosity-driven
Contoh:
- "Gak Nyangka! Ternyata Ini Alasan Kenapa..."
- "Viral! Kejadian Ini Bikin Netizen Heboh"
- "Berani Coba? Fakta Mengejutkan Tentang..."
Best for: Social media, viral content, entertainment
Tujuan: Professional, journalistic, factual
Contoh:
- "Pemerintah Umumkan Kebijakan Baru Soal..."
- "Pakar: Ekonomi Indonesia Diprediksi..."
- "Studi Terbaru: Temuan Penelitian Menunjukkan..."
Best for: News portals, corporate, official announcements
Tujuan: Friendly, conversational, approachable
Contoh:
- "Eh, Ternyata Fakta Menarik Ini Lho!"
- "Akhirnya! Event yang Ditunggu-tunggu"
- "Seru Nih: Topik yang Lagi Rame Dibahas"
Best for: Lifestyle blogs, community content, relatable stories
Tujuan: Engaging, curiosity-provoking
Contoh:
- "Kenapa Topik Ini Jadi Viral?"
- "Apa yang Terjadi Kalau Skenario Ini Terjadi?"
- "Siapa Sangka Subjek Ini Bisa Aksi Begitu?"
Best for: Educational content, discussion starters, engagement
Tujuan: Narrative, emotional, humanistic
Contoh:
- "Kisah Inspiratif di Balik Kejadian Ini"
- "Dari Kondisi Sulit Hingga Sukses Gemilang"
- "Perjuangan Melawan Tantangan yang Luar Biasa"
Best for: Human interest stories, features, emotional content
Guide lengkap: HEADLINE_STYLES.md
Karakteristik:
- White overlay box di tengah/bawah
- Text hitam di dalam box
- Source attribution di bottom right
- Brand text di bottom left (optional)
- Clean dan professional
Visual:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ
โ [Background Image] โ
โ (Slightly Darkened) โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Headline Text Here โ โ
โ โ โ โ
โ โ Brand Sumber: XX โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Best for: Professional content, news articles, formal announcements
Karakteristik:
- Badge "NEWS UPDATE" di top left (red background)
- Source logo di top right (AI-extracted)
- Full background image (no darkening)
- Gradient overlay di bottom
- Text putih di atas gradient
- Modern dan eye-catching
Visual:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โโโโโโโโโโโโโ Kompas โ
โ โNEWS UPDATEโ โ
โ โโโโโโโโโโโโโ โ
โ โ
โ [Full Background Image] โ
โ โ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโ โ
โ โ Headline Text Putih โ โ
โ โ Di Atas Gradient โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Best for: Breaking news, viral content, social media stories
Dokumentasi lengkap: LAYOUT2_DOCUMENTATION.md
Sistem sekarang menggunakan Gemini AI untuk mengidentifikasi nama media, bukan hanya parsing domain!
URL: https://www.kompas.com/artikel
Output: Sumber: www.kompas.com โ Domain mentah
URL: https://www.kompas.com/artikel
Output: Sumber: Kompas โ Nama media yang clean!
| URL | AI-Extracted Source |
|---|---|
| www.kompas.com | Kompas |
| news.detik.com | Detik |
| www.cnnindonesia.com | CNN Indonesia |
| katadata.co.id | Katadata |
| tirto.id | Tirto |
Keuntungan:
- โ Lebih user-friendly dan professional
- โ Konsisten untuk semua media
- โ AI bisa identify dari HTML metadata
- โ Fallback ke domain jika AI gagal
- โ No manual mapping needed!
Dokumentasi: AI_SOURCE_EXTRACTION.md
Integrate ke aplikasi Python kamu sendiri:
from headline_generator import HeadlineGenerator
# Initialize
generator = HeadlineGenerator()
# Basic - default settings
output_path = generator.generate_post(
url="https://www.kompas.com/artikel"
)
# Dengan style
output_path = generator.generate_post(
url="https://www.detik.com/artikel",
style="formal" # clickbait/formal/casual/question/storytelling
)
# Dengan layout
output_path = generator.generate_post(
url="https://www.cnnindonesia.com/artikel",
style="clickbait",
layout="layout2" # layout1 (default) or layout2
)
# Full options
output_path = generator.generate_post(
url="https://example.com/artikel",
output_filename="my_post.png",
brand_text="MyBrand",
style="storytelling",
layout="layout2",
show_source=True # True/False/None (use config)
)
print(f"โ Post created: {output_path}")urls = [
"https://www.kompas.com/artikel1",
"https://www.detik.com/artikel2",
"https://www.cnnindonesia.com/artikel3"
]
generator = HeadlineGenerator()
for url in urls:
try:
output = generator.generate_post(
url=url,
style="clickbait",
layout="layout2"
)
print(f"โ Generated: {output}")
except Exception as e:
print(f"โ Failed {url}: {e}")Semua settings ada di config.py - JANGAN edit hardcoded values di script!
IMAGE_WIDTH = 1080
IMAGE_HEIGHT = 1350 # Instagram Portrait
# Preset lain:
# 1080 x 1080 - Instagram Square
# 1080 x 1920 - Instagram Story
# 1200 x 675 - TwitterTITLE_FONT_SIZE = 48
SOURCE_FONT_SIZE = 24
TITLE_FONT_PATH = "/path/to/font.ttf"WHITE_BOX_COLOR = (255, 255, 255, 240) # White box
TEXT_COLOR = (0, 0, 0, 255) # Black text
SOURCE_COLOR = (100, 100, 100, 255) # Gray
BRAND_COLOR = (50, 50, 50, 255) # Dark grayBOX_MARGIN = 40 # Distance from edge
BOX_PADDING = 30 # Padding inside box
BOX_RADIUS = 20 # Corner radius
LINE_HEIGHT = 60 # Space between linesSHOW_SOURCE = True # Toggle source attribution
SOURCE_TEXT = "Sumber" # Label text
SHOW_BRAND = False
BRAND_TEXT = ""LAYOUT2_BADGE_TEXT = "NEWS UPDATE"
LAYOUT2_BADGE_BG_COLOR = (220, 20, 60, 255) # Red
LAYOUT2_GRADIENT_HEIGHT = 400
LAYOUT2_TEXT_COLOR = (255, 255, 255, 255) # WhiteGEMINI_MODEL = "models/gemini-flash-latest"
GEMINI_TEMPERATURE = 0.9 # Per style bisa bedaHEADLINE_STYLES = {
"clickbait": {
"name": "Clickbait",
"temperature": 0.9,
"prompt": """...""" # Custom prompt
},
# ... 4 styles lainnya
}Guide lengkap: CONFIG_GUIDE.md
headline-ai/
โโโ headline_generator.py # Core generator script
โโโ app.py # Flask web server
โโโ config.py # โ๏ธ SEMUA KONFIGURASI DI SINI
โโโ requirements.txt # Python dependencies
โโโ .env # API keys (git-ignored)
โโโ .env.example # Template .env
โ
โโโ templates/ # Web UI templates
โ โโโ base.html # Base template (dark mode)
โ โโโ index.html # Generate page
โ โโโ gallery.html # Gallery page
โ โโโ settings.html # Settings page
โ
โโโ output/ # ๐ Generated posts
โโโ web_settings.json # Web UI settings cache
โ
โโโ README.md # ๐ Dokumentasi utama (ini!)
โโโ CONFIG_GUIDE.md # Guide konfigurasi
โโโ WEB_UI_GUIDE.md # Guide Web UI
โโโ HEADLINE_STYLES.md # Guide 5 headline styles
โโโ LAYOUT2_DOCUMENTATION.md # Guide Layout 2
โโโ AI_SOURCE_EXTRACTION.md # Guide AI source extraction
โโโ SOURCE_ATTRIBUTION_UPDATE.md # Guide source customization
Error: GEMINI_API_KEY not found
Solution:
echo "GEMINI_API_KEY=your_key_here" > .envWarning: Font not found, using default
Solution: Install DejaVu fonts
# Ubuntu/Debian
sudo apt-get install fonts-dejavu
# macOS - usually pre-installed
# Windows - download manuallyWarning: No valid images found, using default background
Penyebab:
- Website blocking automated requests
- Image tidak ditemukan di HTML
- Image size terlalu kecil
Solution:
- Script akan auto fallback ke default background
- Atau adjust
MIN_IMAGE_WIDTHdanMIN_IMAGE_HEIGHTdi config.py
ModuleNotFoundError: No module named 'openai'
Solution:
pip install -r requirements.txtError: Address already in use
Solution:
# Kill process di port 5000
lsof -ti:5000 | xargs kill -9
# Atau ganti port di app.py
app.run(port=5001)- Python 3.7+
- Gemini API Key (gratis dari https://ai.google.dev/)
- Internet connection
- Fonts: DejaVu Sans (optional, fallback tersedia)
openai
requests
beautifulsoup4
pillow
python-dotenv
flask
jinja2
Install semua:
pip install -r requirements.txt- Generate post Instagram otomatis dari artikel
- Konsisten branding dengan custom badge
- Multiple styles untuk different sections
- Repurpose artikel jadi IG post
- Clickbait style untuk viral content
- Question style untuk engagement
- Batch generate posts dari multiple URLs
- Gallery untuk manage semua hasil
- Quick customization via Web UI
- Integrate ke workflow otomatis
- Python API untuk scripting
- CLI untuk cron jobs
- 5 Headline styles dengan custom prompts
- 2 Layout designs (White Box + News Update)
- AI source extraction (Gemini identifies media name)
- Web UI dengan dark mode
- Gallery dengan sorting & NEW badge
- Customizable source attribution
- CLI dengan full options
- Python API
- Layout 3: Minimalist style
- Video/GIF support untuk Instagram Story
- Multi-language headline generation
- Template system untuk custom layouts
- Integration dengan Instagram API (auto post)
- Bulk upload dari CSV
- A/B testing untuk headlines
MIT License - bebas untuk digunakan, dimodifikasi, dan didistribusikan.
Developed by: Claude (Anthropic AI) For: Folkative Indonesia & Open Source Community
Powered by:
- Gemini AI (Google)
- Python
- Flask
- Tailwind CSS
- CONFIG_GUIDE.md - Panduan konfigurasi lengkap
- WEB_UI_GUIDE.md - Guide Web Interface
- HEADLINE_STYLES.md - 5 Headline styles dengan contoh
- LAYOUT2_DOCUMENTATION.md - Layout 2 documentation
- AI_SOURCE_EXTRACTION.md - AI source extraction guide
- SOURCE_ATTRIBUTION_UPDATE.md - Source customization
- Get API Key: https://ai.google.dev/
- Gemini Docs: https://ai.google.dev/docs
- Issue Tracker: (Add your repo link here)
- Install Python 3.7+
- Clone/download project
- Run
pip install -r requirements.txt - Get Gemini API key dari https://ai.google.dev/
- Create
.envfile dengan API key - Run
python app.pyuntuk Web UI - Atau
python headline_generator.py <url>untuk CLI - Explore settings di config.py
- Generate post pertama kamu!
- Baca dokumentasi untuk advanced features
Happy Generating! ๐