Skip to content

Latest commit

 

History

13 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Reels Pipeline

Instagram saved reels → Whisper + Claude API → Notion DB pipeline

Instagram'da kaydettiğin reels'leri uçtan uca otomatik bir akışla işleyen bir veri hattı: ses transkripsiyonu (OpenAI Whisper) + içerik kategorizasyonu (Anthropic Claude) + sonuçları Notion veritabanına yazma.

Akış

  1. parse-saved → Instagram'ın export ettiği saved_posts.json parse edilir
  2. fetch-reel → Her reel için video/medya indirilir
  3. transcribe → Whisper ile ses → metin
  4. categorize → Claude ile kategori + özet + etiket çıkarımı
  5. notion-push → Sonuç Notion DB'ye yeni page olarak yazılır

main.ts bu 5 modülü orchestrate eder.

Sistem Gereksinimleri

fetch-reel adımı yt-dlp ve ffmpeg sistem komutlarına ihtiyaç duyar (npm wrapper kullanılmıyor — doğrudan binary çağrılıyor):

brew install ffmpeg
brew install pipx && pipx install yt-dlp     # pyenv ile de kurulabilir

Doğrula:

yt-dlp --version
ffmpeg -version       # tek tire — '--version' ffmpeg'de çalışmaz

Not: fetch-reel.ts içinde YT_DLP sabiti hardcoded path olarak tutuluyor (varsayılan: /Users/irfaneodabas/.pyenv/versions/3.11.10/bin/yt-dlp). Farklı makinede çalıştırırken bu yolu kendi yt-dlp kurulumuna güncelle. Sebep: homebrew-yt-dlp + sistem Python kombinasyonu expat C extension eksikliğinden Instagram'da çöküyor (bkz. CLAUDE.md Decisions Log).

Node.js 22.6+ gereklidir (TypeScript dosyaları --experimental-strip-types ile native çalıştırılır).

Kurulum

npm install
cp .env.example .env
# .env dosyasını kendi API key'lerinle doldur
npm start

Kullanım

npm run parse:test                        # Mock saved_posts ile parser denemesi
npm run fetch -- <instagram-reel-url>     # Tek bir reel'i indirir → data/audio/
npm start                                 # Tam pipeline (main.ts)

Klasör Yapısı

src/
  parse-saved.ts    # Instagram saved_posts.json parser
  fetch-reel.ts     # Reel video/medya indirici
  transcribe.ts     # Whisper transkripsiyon
  categorize.ts     # Claude ile kategorizasyon
  notion-push.ts    # Notion DB writer
  main.ts           # Pipeline orchestrator
data/
  input/            # saved_posts.json girişi
  audio/            # İndirilen medya/ses dosyaları

Ortam Değişkenleri

  • ANTHROPIC_API_KEY — Claude API
  • OPENAI_API_KEY — Whisper transcription
  • NOTION_TOKEN — Notion integration token
  • NOTION_DATABASE_ID — Hedef Notion DB ID (32-char hex, DB ID — page ID değil)

Production Kullanım

Gerçek Instagram saved reels arşivini işlemek için:

1. Instagram saved posts export'unu indir

Instagram → Settings → Accounts Center → Your information and permissions → Download your information → "Some of your information" → Saved seç → JSON formatı, "All time" tarih aralığı → request başlat.

E-posta birkaç saatte gelir; ZIP içinde your_instagram_activity/saved/saved_posts.json yolunda dosya bulunur. Bu dosyayı data/input/saved_posts.json olarak kopyala.

2. Cookie dosyası hazırla

Instagram reels çoğunlukla login-walled. Tarayıcına "Get cookies.txt LOCALLY" extension'ını kur, instagram.com'a giriş yapmışken extension'a tıklayıp cookies'i Netscape format olarak indir, data/input/cookies.txt olarak kaydet.

Cookies session-bound: birkaç hafta içinde expire olabilir. Pipeline "login required" hatası verirse cookies'i yenile.

3. Notion DB hazırla

DB property'leri (default Notion DB'leri eksik gelir, üzerine ekle):

Property Tip Notlar
Name Title Notion'un default title field'ı
URL URL
Saved Date Date
Category Select Options: claude-code, github, book, video, chess, other
Action Select Options: apply-now, watch-later, archive (yoksa runtime'da auto-eklenir)
Summary Rich text
Transcript Rich text

DB'yi pipeline integration'ı ile paylaş (Notion DB sayfası → Connections → integration ekle).

NOTION_DATABASE_ID için: DB'nin kendi sayfasını full-page olarak aç → URL'deki son 32-char hex blok DB ID'si. Page-with-embedded-DB'nin URL'si değil!

4. .env'i doldur

cp .env.example .env
# 4 değişkeni de gerçek key'lerle doldur (NOTION_DATABASE_ID 32 char olmalı)

5. Çalıştır

npm start
# Tüm reel'ler tek tek işlenir, her reel arası 1 saniye rate limit

Resume capability: Pipeline data/state.json'da her reel'in durumunu tutar. Yarıda kesilse veya bir reel patlasa bile, npm start tekrar çalıştırılınca pushed durumundakiler atlanır, pending/failed olanlar kaldığı yerden devam eder.

Maliyet tahmini: ~$0.004 / reel (Whisper + Claude). 1000 reel ≈ ~$4. (Notion API ücretsiz.)

Sorun Giderme

Hata Çözüm
'ffmpeg' bulunamadı brew install ffmpegffmpeg -version ile doğrula (tek tire)
No module named expat yt-dlp homebrew kurulumu bozuk; pipx install yt-dlp ile kur
is a page, not a database NOTION_DATABASE_ID page ID — DB'nin kendi URL'sinden 32-char ID al
is not a property that exists Notion DB schema'sında bu isimde property yok — yukarıdaki tabloya göre oluştur
Could not categorize automatically Reel'in transcript'i çok kısa (instrumental/efekt); Claude fallback'e düştü, other kategorisine atandı (beklenen davranış)

Geliştirme Kuralları

Detaylı mimari, kategori listesi, operasyonel kurallar ve geliştirme tarihinde verilen tüm kararlar için bkz. CLAUDE.md.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages