Files
screenclipper/packages/db/prisma/schema.prisma
T
ayrisdevandClaude Sonnet 5 ccd922ba37 feat: birden fazla YouTube hesabı arasında cookie'yi dağıt (Faz 6)
Proxy IP'lerini havuza dağıttığımız aynı sorun cookie/hesap seviyesinde de
vardı: tek bir Google hesabı 7-8 kanalı taramaya çalışınca YouTube hesabın
kendisini şüpheli bulup çoğu/tüm kanalda "Sign in to confirm you're not a
bot" veriyordu — proxy IP'den bağımsız bir sinyal, IP dağıtımı bunu
çözemez.

Yeni CookieProfile tablosu: her kanal, DB id'sinden aynı deterministik hash
ile (proxyUrlForChannel'daki gibi) havuzdaki hesaplardan birine sabitlenir.
Her profil kendi ayrı geçici dosyasına yazılıyor (/tmp/yt-cookies-<id>.txt)
— tek paylaşılan dosya, farklı profil kullanan kanallar eşzamanlı
çalışınca birbirinin cookie'sini ezerdi. Hiç profil eklenmemişse eski tekli
ytdlp_cookies ayarına geri düşüyor (geriye dönük uyumlu, hemen kırılmaz).

Ayarlar sayfasında yeni "Cookie Hesapları" kartı: hesap ekle/sil/yenile,
her biri için ayrı bayatlık rozeti. Eski tekli cookie kartı "tekli/eski"
etiketiyle fallback olarak duruyor.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 01:20:36 +03:00

135 lines
3.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
enum RawSegmentStatus {
PENDING
PROCESSED
DISCARDED
}
enum CandidateSegmentStatus {
PENDING_STT
TRANSCRIBED
FAILED
}
enum ShortVideoStatus {
PENDING
RENDERING
READY
FAILED
}
model Channel {
id String @id @default(cuid())
name String
youtubeHandle String @map("youtube_handle")
channelId String @unique @map("channel_id")
isActive Boolean @default(true) @map("is_active")
lastCheckedAt DateTime? @map("last_checked_at")
createdAt DateTime @default(now()) @map("created_at")
// null = global varsayılanı (SEGMENT_TIME_SEC env var) kullan
segmentTimeSec Int? @map("segment_time_sec")
sessions StreamSession[]
@@map("channels")
}
model StreamSession {
id String @id @default(cuid())
channelId String @map("channel_id")
channel Channel @relation(fields: [channelId], references: [id])
liveVideoId String? @map("live_video_id")
startedAt DateTime @default(now()) @map("started_at")
endedAt DateTime? @map("ended_at")
totalSegments Int @default(0) @map("total_segments")
segments RawSegment[]
@@map("stream_sessions")
}
model RawSegment {
id String @id @default(cuid())
sessionId String @map("session_id")
session StreamSession @relation(fields: [sessionId], references: [id])
filePath String @map("file_path")
duration Int
startedAt DateTime @map("started_at")
status RawSegmentStatus @default(PENDING)
createdAt DateTime @default(now()) @map("created_at")
candidates CandidateSegment[]
@@map("raw_segments")
}
model CandidateSegment {
id String @id @default(cuid())
rawSegmentId String @map("raw_segment_id")
rawSegment RawSegment @relation(fields: [rawSegmentId], references: [id])
startSec Int @map("start_sec")
endSec Int @map("end_sec")
audioPeakScore Float? @map("audio_peak_score")
chatVelocityScore Float? @map("chat_velocity_score")
transcriptJson Json? @map("transcript_json")
status CandidateSegmentStatus @default(PENDING_STT)
createdAt DateTime @default(now()) @map("created_at")
short ShortVideo?
@@map("candidate_segments")
}
model ShortVideo {
id String @id @default(cuid())
candidateId String @unique @map("candidate_id")
candidate CandidateSegment @relation(fields: [candidateId], references: [id])
filePath String? @map("file_path")
status ShortVideoStatus @default(PENDING)
errorMessage String? @map("error_message")
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("short_videos")
}
// Birden fazla YouTube hesabının cookie'si — her kanal (channel.id'den
// deterministik bir hash ile) bu havuzdaki bir profile sabitlenir, tek bir
// hesabın çok fazla kanalı taramasından kaynaklanan hesap-seviyesi
// bot-tespitini havuza yayarak azaltır (bkz. proxyUrlForChannel ile aynı
// mantık, ytdlpCookies.ts).
model CookieProfile {
id String @id @default(cuid())
label String
value String
createdAt DateTime @default(now()) @map("created_at")
updatedAt DateTime @updatedAt @map("updated_at")
@@map("cookie_profiles")
}
model AppSetting {
key String @id
value String
updatedAt DateTime @updatedAt @map("updated_at")
@@map("app_settings")
}
model User {
id String @id @default(cuid())
username String @unique
passwordHash String @map("password_hash")
createdAt DateTime @default(now()) @map("created_at")
@@map("users")
}