ilginç
This commit is contained in:
@@ -177,6 +177,12 @@ class Database:
|
|||||||
conn = self.connect()
|
conn = self.connect()
|
||||||
cursor = conn.cursor()
|
cursor = conn.cursor()
|
||||||
now_utc = datetime.now(timezone.utc).isoformat()
|
now_utc = datetime.now(timezone.utc).isoformat()
|
||||||
|
|
||||||
|
# Debug: Transcript kaydı öncesi kontrol
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
logger.debug(f"[DATABASE] Video {video_id} transcript kaydediliyor - Raw uzunluk: {len(raw) if raw else 0}, Clean uzunluk: {len(clean) if clean else 0}, Status: {status}")
|
||||||
|
|
||||||
cursor.execute("""
|
cursor.execute("""
|
||||||
UPDATE videos
|
UPDATE videos
|
||||||
SET transcript_raw = ?,
|
SET transcript_raw = ?,
|
||||||
@@ -187,8 +193,35 @@ class Database:
|
|||||||
last_updated_utc = ?
|
last_updated_utc = ?
|
||||||
WHERE video_id = ?
|
WHERE video_id = ?
|
||||||
""", (raw, clean, status, language, now_utc, now_utc, video_id))
|
""", (raw, clean, status, language, now_utc, now_utc, video_id))
|
||||||
|
|
||||||
|
# Kayıt başarılı mı kontrol et
|
||||||
|
rows_affected = cursor.rowcount
|
||||||
conn.commit()
|
conn.commit()
|
||||||
|
|
||||||
|
if rows_affected > 0:
|
||||||
|
# Kayıt sonrası doğrulama
|
||||||
|
cursor.execute("SELECT transcript_clean, transcript_status FROM videos WHERE video_id = ?", (video_id,))
|
||||||
|
row = cursor.fetchone()
|
||||||
|
if row:
|
||||||
|
# sqlite3.Row objesi dict gibi davranır (row['column'] şeklinde erişilebilir)
|
||||||
|
# Ama isinstance(row, dict) False döner, bu yüzden try-except kullanıyoruz
|
||||||
|
try:
|
||||||
|
saved_clean = row['transcript_clean']
|
||||||
|
saved_status = row['transcript_status']
|
||||||
|
except (KeyError, TypeError, IndexError):
|
||||||
|
# Fallback: index ile erişim
|
||||||
|
saved_clean = row[0] if len(row) > 0 else None
|
||||||
|
saved_status = row[1] if len(row) > 1 else None
|
||||||
|
|
||||||
|
if saved_clean and saved_status == status:
|
||||||
|
logger.info(f"[DATABASE] ✅ Video {video_id} transcript başarıyla kaydedildi - Clean uzunluk: {len(saved_clean)}, Status: {saved_status}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"[DATABASE] ⚠️ Video {video_id} transcript kaydı şüpheli - Clean: {'var' if saved_clean else 'yok'}, Status: {saved_status}")
|
||||||
|
else:
|
||||||
|
logger.error(f"[DATABASE] ❌ Video {video_id} transcript kaydı sonrası doğrulama başarısız - Video bulunamadı")
|
||||||
|
else:
|
||||||
|
logger.warning(f"[DATABASE] ⚠️ Video {video_id} transcript kaydı yapılamadı - Hiçbir satır güncellenmedi (video_id mevcut mu?)")
|
||||||
|
|
||||||
def get_processed_videos(self, limit: Optional[int] = None,
|
def get_processed_videos(self, limit: Optional[int] = None,
|
||||||
channel_id: Optional[str] = None) -> List[Dict]:
|
channel_id: Optional[str] = None) -> List[Dict]:
|
||||||
"""İşlenmiş videoları getir (status=1)"""
|
"""İşlenmiş videoları getir (status=1)"""
|
||||||
@@ -218,7 +251,23 @@ class Database:
|
|||||||
params.append(limit)
|
params.append(limit)
|
||||||
|
|
||||||
cursor.execute(query, params)
|
cursor.execute(query, params)
|
||||||
return [dict(row) for row in cursor.fetchall()]
|
videos = [dict(row) for row in cursor.fetchall()]
|
||||||
|
|
||||||
|
# Debug: transcript_clean alanının varlığını kontrol et ve logla
|
||||||
|
import logging
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
videos_with_transcript = [v for v in videos if v.get('transcript_clean')]
|
||||||
|
videos_without_transcript = [v for v in videos if not v.get('transcript_clean')]
|
||||||
|
|
||||||
|
if videos_without_transcript:
|
||||||
|
video_ids_no_transcript = [v.get('video_id', 'N/A') for v in videos_without_transcript[:5]]
|
||||||
|
logger.warning(f"[DATABASE] ⚠️ {len(videos_without_transcript)} video transcript_clean alanı olmadan döndürüldü (ilk 5 ID: {', '.join(video_ids_no_transcript)})")
|
||||||
|
|
||||||
|
if videos_with_transcript:
|
||||||
|
video_ids_with_transcript = [v.get('video_id', 'N/A') for v in videos_with_transcript[:5]]
|
||||||
|
logger.debug(f"[DATABASE] ✅ {len(videos_with_transcript)} video transcript_clean alanı ile döndürüldü (ilk 5 ID: {', '.join(video_ids_with_transcript)})")
|
||||||
|
|
||||||
|
return videos
|
||||||
|
|
||||||
def mark_video_failed(self, video_id: str, reason: Optional[str] = None):
|
def mark_video_failed(self, video_id: str, reason: Optional[str] = None):
|
||||||
"""Video'yu başarısız olarak işaretle (status=2)"""
|
"""Video'yu başarısız olarak işaretle (status=2)"""
|
||||||
|
|||||||
@@ -5,6 +5,9 @@ from feedgen.feed import FeedGenerator
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import List, Dict
|
from typing import List, Dict
|
||||||
import pytz
|
import pytz
|
||||||
|
import logging
|
||||||
|
|
||||||
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class RSSGenerator:
|
class RSSGenerator:
|
||||||
@@ -35,10 +38,16 @@ class RSSGenerator:
|
|||||||
Args:
|
Args:
|
||||||
video: Video metadata dict
|
video: Video metadata dict
|
||||||
"""
|
"""
|
||||||
|
video_id = video.get('video_id', 'N/A')
|
||||||
|
|
||||||
|
# transcript_clean alanı kontrolü
|
||||||
|
if not video.get('transcript_clean'):
|
||||||
|
logger.warning(f"[RSS] ⚠️ Video {video_id} RSS feed'e ekleniyor ama transcript_clean alanı yok!")
|
||||||
|
|
||||||
fe = self.fg.add_entry()
|
fe = self.fg.add_entry()
|
||||||
|
|
||||||
# GUID (video ID)
|
# GUID (video ID)
|
||||||
fe.id(video['video_id'])
|
fe.id(video_id)
|
||||||
|
|
||||||
# Title
|
# Title
|
||||||
fe.title(video.get('video_title', ''))
|
fe.title(video.get('video_title', ''))
|
||||||
|
|||||||
@@ -1,7 +1,20 @@
|
|||||||
"""
|
"""
|
||||||
YouTube transcript çıkarımı modülü
|
YouTube transcript çıkarımı modülü
|
||||||
"""
|
"""
|
||||||
from youtube_transcript_api import YouTubeTranscriptApi
|
from youtube_transcript_api import (
|
||||||
|
YouTubeTranscriptApi,
|
||||||
|
TranscriptsDisabled,
|
||||||
|
NoTranscriptFound,
|
||||||
|
)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from youtube_transcript_api import NoTranscriptAvailable # type: ignore
|
||||||
|
except ImportError:
|
||||||
|
try:
|
||||||
|
from youtube_transcript_api._errors import NoTranscriptAvailable # type: ignore
|
||||||
|
except ImportError: # pragma: no cover - fallback for unexpected API changes
|
||||||
|
class NoTranscriptAvailable(Exception): # type: ignore
|
||||||
|
"""Fallback exception when youtube_transcript_api does not expose NoTranscriptAvailable."""
|
||||||
from typing import List, Dict, Optional
|
from typing import List, Dict, Optional
|
||||||
import time
|
import time
|
||||||
import logging
|
import logging
|
||||||
@@ -178,19 +191,67 @@ class TranscriptExtractor:
|
|||||||
try:
|
try:
|
||||||
logger.debug(f"[TRANSCRIPT] YouTube Transcript API çağrısı yapılıyor: video_id={video_id}")
|
logger.debug(f"[TRANSCRIPT] YouTube Transcript API çağrısı yapılıyor: video_id={video_id}")
|
||||||
|
|
||||||
# YouTube Transcript API kullanımı (yeni versiyon)
|
|
||||||
# API instance oluştur ve fetch() metodunu kullan
|
|
||||||
api = YouTubeTranscriptApi()
|
api = YouTubeTranscriptApi()
|
||||||
fetched_transcript = api.fetch(video_id, languages=languages)
|
transcript_list = api.list(video_id)
|
||||||
|
logger.debug(
|
||||||
|
f"[TRANSCRIPT] {video_id} için {len(transcript_list)} transcript adayı bulundu"
|
||||||
|
)
|
||||||
|
|
||||||
# Eski formatı döndürmek için to_raw_data() kullan
|
selected_transcript = None
|
||||||
# Format: [{'text': '...', 'start': 1.36, 'duration': 1.68}, ...]
|
|
||||||
|
if languages:
|
||||||
|
try:
|
||||||
|
selected_transcript = transcript_list.find_transcript(languages)
|
||||||
|
logger.debug(
|
||||||
|
f"[TRANSCRIPT] Öncelikli dillerden transcript bulundu: {selected_transcript.language_code}"
|
||||||
|
)
|
||||||
|
except NoTranscriptFound:
|
||||||
|
logger.warning(
|
||||||
|
f"[TRANSCRIPT] İstenen dillerde transcript bulunamadı: {languages}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not selected_transcript:
|
||||||
|
for language in languages:
|
||||||
|
try:
|
||||||
|
selected_transcript = transcript_list.find_manually_created_transcript([language])
|
||||||
|
logger.debug(
|
||||||
|
f"[TRANSCRIPT] {language} dili için manuel transcript bulundu"
|
||||||
|
)
|
||||||
|
break
|
||||||
|
except NoTranscriptFound:
|
||||||
|
try:
|
||||||
|
selected_transcript = transcript_list.find_generated_transcript([language])
|
||||||
|
logger.debug(
|
||||||
|
f"[TRANSCRIPT] {language} dili için otomatik transcript bulundu"
|
||||||
|
)
|
||||||
|
break
|
||||||
|
except NoTranscriptFound:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if not selected_transcript and transcript_list:
|
||||||
|
selected_transcript = transcript_list[0]
|
||||||
|
logger.info(
|
||||||
|
f"[TRANSCRIPT] İstenen diller bulunamadı, ilk uygun transcript seçildi: {selected_transcript.language_code}"
|
||||||
|
)
|
||||||
|
|
||||||
|
if not selected_transcript:
|
||||||
|
logger.warning(f"[TRANSCRIPT] Video {video_id} için hiç transcript bulunamadı")
|
||||||
|
return None
|
||||||
|
|
||||||
|
fetched_transcript = selected_transcript.fetch()
|
||||||
transcript = fetched_transcript.to_raw_data()
|
transcript = fetched_transcript.to_raw_data()
|
||||||
|
|
||||||
transcript_count = len(transcript) if transcript else 0
|
transcript_count = len(transcript) if transcript else 0
|
||||||
logger.info(f"[TRANSCRIPT] ✅ Video {video_id} transcript'i başarıyla çıkarıldı ({transcript_count} segment)")
|
logger.info(
|
||||||
|
f"[TRANSCRIPT] ✅ Video {video_id} transcript'i başarıyla çıkarıldı ({transcript_count} segment, dil: {selected_transcript.language_code})"
|
||||||
|
)
|
||||||
|
|
||||||
return transcript
|
return transcript
|
||||||
|
except (TranscriptsDisabled, NoTranscriptAvailable) as e:
|
||||||
|
logger.error(
|
||||||
|
f"[TRANSCRIPT] ❌ Video {video_id} için transcript devre dışı bırakılmış veya mevcut değil: {type(e).__name__} - {e}"
|
||||||
|
)
|
||||||
|
return None
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
error_msg = str(e)
|
error_msg = str(e)
|
||||||
error_type = type(e).__name__
|
error_type = type(e).__name__
|
||||||
|
|||||||
@@ -259,7 +259,6 @@ def process_channel(channel_id: str, max_items: int = 50) -> dict:
|
|||||||
|
|
||||||
# ÖNCE: Mevcut işlenmiş videoları kontrol et
|
# ÖNCE: Mevcut işlenmiş videoları kontrol et
|
||||||
existing_processed = db.get_processed_videos(limit=max_items, channel_id=channel_id)
|
existing_processed = db.get_processed_videos(limit=max_items, channel_id=channel_id)
|
||||||
logger.info(f"[PROCESS] Channel {channel_id} için {len(existing_processed)} mevcut işlenmiş video bulundu (max_items: {max_items})")
|
|
||||||
|
|
||||||
# Debug: Veritabanında kaç video var (tüm status'ler)
|
# Debug: Veritabanında kaç video var (tüm status'ler)
|
||||||
try:
|
try:
|
||||||
@@ -280,29 +279,43 @@ def process_channel(channel_id: str, max_items: int = 50) -> dict:
|
|||||||
# sqlite3.Row formatı
|
# sqlite3.Row formatı
|
||||||
status_counts[row[0]] = row[1]
|
status_counts[row[0]] = row[1]
|
||||||
logger.info(f"[PROCESS] 📊 Veritabanı durumu - Channel {channel_id}: Status 0 (bekleyen): {status_counts.get(0, 0)}, Status 1 (işlenmiş): {status_counts.get(1, 0)}, Status 2 (başarısız): {status_counts.get(2, 0)}")
|
logger.info(f"[PROCESS] 📊 Veritabanı durumu - Channel {channel_id}: Status 0 (bekleyen): {status_counts.get(0, 0)}, Status 1 (işlenmiş): {status_counts.get(1, 0)}, Status 2 (başarısız): {status_counts.get(2, 0)}")
|
||||||
|
|
||||||
# İşlenmiş videoların video_id'lerini de logla (ilk 5)
|
|
||||||
if len(existing_processed) > 0:
|
|
||||||
video_ids = [v.get('video_id', 'N/A') for v in existing_processed[:5]]
|
|
||||||
logger.info(f"[PROCESS] 📋 İşlenmiş video ID'leri (ilk 5): {', '.join(video_ids)}")
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.error(f"[PROCESS] ❌ Veritabanı durumu kontrol hatası: {type(e).__name__} - {str(e)}")
|
logger.error(f"[PROCESS] ❌ Veritabanı durumu kontrol hatası: {type(e).__name__} - {str(e)}")
|
||||||
|
|
||||||
# Eğer yeterli sayıda işlenmiş video varsa, onları hemen döndür
|
# Veritabanı sorgusu tamamlandıktan SONRA log mesajları yazılmalı
|
||||||
if len(existing_processed) >= max_items:
|
logger.info(f"[PROCESS] Channel {channel_id} için {len(existing_processed)} mevcut işlenmiş video bulundu (max_items: {max_items})")
|
||||||
logger.info(f"[PROCESS] ✅ Yeterli işlenmiş video var ({len(existing_processed)}), yeni işleme başlatılmıyor")
|
|
||||||
|
# transcript_clean alanının varlığını kontrol et ve logla
|
||||||
|
existing_with_transcript = [v for v in existing_processed if v.get('transcript_clean')]
|
||||||
|
existing_without_transcript = [v for v in existing_processed if not v.get('transcript_clean')]
|
||||||
|
|
||||||
|
if existing_without_transcript:
|
||||||
|
video_ids_no_transcript = [v.get('video_id', 'N/A') for v in existing_without_transcript[:5]]
|
||||||
|
logger.warning(f"[PROCESS] ⚠️ {len(existing_without_transcript)} mevcut video transcript_clean alanı olmadan bulundu (ilk 5 ID: {', '.join(video_ids_no_transcript)})")
|
||||||
|
|
||||||
|
if existing_with_transcript:
|
||||||
|
video_ids_with_transcript = [v.get('video_id', 'N/A') for v in existing_with_transcript[:5]]
|
||||||
|
logger.info(f"[PROCESS] 📋 İşlenmiş video ID'leri (transcript_clean ile, ilk 5): {', '.join(video_ids_with_transcript)}")
|
||||||
|
|
||||||
|
# Sadece transcript_clean alanı olan videoları say
|
||||||
|
existing_with_transcript_count = len(existing_with_transcript)
|
||||||
|
|
||||||
|
# Eğer yeterli sayıda işlenmiş video varsa (transcript_clean ile), onları hemen döndür
|
||||||
|
if existing_with_transcript_count >= max_items:
|
||||||
|
logger.info(f"[PROCESS] ✅ Yeterli işlenmiş video var (transcript_clean ile: {existing_with_transcript_count}), yeni işleme başlatılmıyor")
|
||||||
return {
|
return {
|
||||||
'videos': existing_processed[:max_items],
|
'videos': existing_with_transcript[:max_items],
|
||||||
'channel_id': channel_id,
|
'channel_id': channel_id,
|
||||||
'count': len(existing_processed[:max_items])
|
'count': len(existing_with_transcript[:max_items])
|
||||||
}
|
}
|
||||||
|
|
||||||
# Eğer mevcut işlenmiş videolar varsa ama yeterli değilse, onları döndür ve yeni işlemeleri başlat
|
# Eğer mevcut işlenmiş videolar varsa ama yeterli değilse, onları döndür ve yeni işlemeleri başlat
|
||||||
# Ancak sadece ilk batch'i işle (hızlı yanıt için)
|
# Ancak sadece ilk batch'i işle (hızlı yanıt için)
|
||||||
if len(existing_processed) > 0:
|
# Sadece transcript_clean alanı olan videoları döndür
|
||||||
logger.info(f"[PROCESS] ⚠️ Mevcut işlenmiş video var ama yeterli değil ({len(existing_processed)}/{max_items}), yeni işleme başlatılıyor")
|
if existing_with_transcript_count > 0:
|
||||||
# Mevcut videoları döndürmek için sakla
|
logger.info(f"[PROCESS] ⚠️ Mevcut işlenmiş video var ama yeterli değil (transcript_clean ile: {existing_with_transcript_count}/{max_items}), yeni işleme başlatılıyor")
|
||||||
videos_to_return = existing_processed.copy()
|
# Mevcut videoları döndürmek için sakla (sadece transcript_clean olanlar)
|
||||||
|
videos_to_return = existing_with_transcript.copy()
|
||||||
else:
|
else:
|
||||||
videos_to_return = []
|
videos_to_return = []
|
||||||
|
|
||||||
@@ -447,12 +460,15 @@ def process_channel(channel_id: str, max_items: int = 50) -> dict:
|
|||||||
channel_id=channel_id
|
channel_id=channel_id
|
||||||
)
|
)
|
||||||
|
|
||||||
|
# Sadece transcript_clean alanı olan yeni videoları filtrele
|
||||||
|
newly_processed_with_transcript = [v for v in newly_processed if v.get('transcript_clean')]
|
||||||
|
|
||||||
# Mevcut videoları ve yeni işlenen videoları birleştir (duplicate kontrolü ile)
|
# Mevcut videoları ve yeni işlenen videoları birleştir (duplicate kontrolü ile)
|
||||||
all_processed_videos = videos_to_return.copy() # Önce mevcut videoları ekle
|
all_processed_videos = videos_to_return.copy() # Önce mevcut videoları ekle (zaten transcript_clean ile filtrelenmiş)
|
||||||
existing_ids = {v['video_id'] for v in all_processed_videos}
|
existing_ids = {v['video_id'] for v in all_processed_videos}
|
||||||
|
|
||||||
# Yeni işlenen videoları ekle
|
# Yeni işlenen videoları ekle (sadece transcript_clean olanlar)
|
||||||
for video in newly_processed:
|
for video in newly_processed_with_transcript:
|
||||||
if video['video_id'] not in existing_ids and len(all_processed_videos) < max_items:
|
if video['video_id'] not in existing_ids and len(all_processed_videos) < max_items:
|
||||||
all_processed_videos.append(video)
|
all_processed_videos.append(video)
|
||||||
|
|
||||||
@@ -463,9 +479,9 @@ def process_channel(channel_id: str, max_items: int = 50) -> dict:
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Debug: Gerçek durumu logla
|
# Debug: Gerçek durumu logla
|
||||||
newly_processed_count = len([v for v in newly_processed if v['video_id'] not in {v['video_id'] for v in videos_to_return}])
|
newly_processed_count = len([v for v in newly_processed_with_transcript if v['video_id'] not in {v['video_id'] for v in videos_to_return}])
|
||||||
logger.info(f"[PROCESS] ✅ Channel {channel_id} işleme tamamlandı - {len(all_processed_videos)} işlenmiş video döndürülüyor")
|
logger.info(f"[PROCESS] ✅ Channel {channel_id} işleme tamamlandı - {len(all_processed_videos)} işlenmiş video döndürülüyor (transcript_clean ile)")
|
||||||
logger.info(f"[PROCESS] 📊 Detay: Mevcut işlenmiş: {len(videos_to_return)}, Yeni işlenen: {newly_processed_count}, Toplam: {len(all_processed_videos)}")
|
logger.info(f"[PROCESS] 📊 Detay: Mevcut işlenmiş (transcript_clean ile): {len(videos_to_return)}, Yeni işlenen (transcript_clean ile): {newly_processed_count}, Toplam: {len(all_processed_videos)}")
|
||||||
|
|
||||||
return {
|
return {
|
||||||
'videos': all_processed_videos[:max_items],
|
'videos': all_processed_videos[:max_items],
|
||||||
@@ -636,10 +652,19 @@ def generate_feed():
|
|||||||
# RSS feed oluştur
|
# RSS feed oluştur
|
||||||
logger.info(f"[FEED] RSS feed oluşturuluyor - Channel: {normalized_channel_id}, Video sayısı: {len(result['videos'])}")
|
logger.info(f"[FEED] RSS feed oluşturuluyor - Channel: {normalized_channel_id}, Video sayısı: {len(result['videos'])}")
|
||||||
|
|
||||||
# Debug: Video ID'lerini logla
|
# transcript_clean alanının varlığını kontrol et ve logla
|
||||||
if result['videos']:
|
videos_with_transcript = [v for v in result['videos'] if v.get('transcript_clean')]
|
||||||
video_ids = [v.get('video_id', 'N/A') for v in result['videos'][:5]]
|
videos_without_transcript = [v for v in result['videos'] if not v.get('transcript_clean')]
|
||||||
logger.info(f"[FEED] 📋 Feed'e eklenecek video ID'leri (ilk 5): {', '.join(video_ids)}")
|
|
||||||
|
if videos_without_transcript:
|
||||||
|
video_ids_no_transcript = [v.get('video_id', 'N/A') for v in videos_without_transcript[:5]]
|
||||||
|
logger.warning(f"[FEED] ⚠️ {len(videos_without_transcript)} video transcript_clean alanı olmadan feed'e ekleniyor (ilk 5 ID: {', '.join(video_ids_no_transcript)})")
|
||||||
|
|
||||||
|
if videos_with_transcript:
|
||||||
|
video_ids_with_transcript = [v.get('video_id', 'N/A') for v in videos_with_transcript[:5]]
|
||||||
|
logger.info(f"[FEED] 📋 Feed'e eklenecek video ID'leri (transcript_clean ile, ilk 5): {', '.join(video_ids_with_transcript)}")
|
||||||
|
else:
|
||||||
|
logger.warning(f"[FEED] ⚠️ Hiçbir videoda transcript_clean alanı yok!")
|
||||||
|
|
||||||
channel_info = {
|
channel_info = {
|
||||||
'id': normalized_channel_id,
|
'id': normalized_channel_id,
|
||||||
@@ -651,10 +676,18 @@ def generate_feed():
|
|||||||
|
|
||||||
generator = RSSGenerator(channel_info)
|
generator = RSSGenerator(channel_info)
|
||||||
|
|
||||||
|
# Sadece transcript_clean alanı olan videoları feed'e ekle
|
||||||
|
added_count = 0
|
||||||
|
skipped_count = 0
|
||||||
for video in result['videos']:
|
for video in result['videos']:
|
||||||
|
if video.get('transcript_clean'):
|
||||||
generator.add_video_entry(video)
|
generator.add_video_entry(video)
|
||||||
|
added_count += 1
|
||||||
|
else:
|
||||||
|
skipped_count += 1
|
||||||
|
logger.debug(f"[FEED] ⏭️ Video {video.get('video_id', 'N/A')} transcript_clean olmadığı için feed'e eklenmedi")
|
||||||
|
|
||||||
logger.info(f"[FEED] ✅ RSS feed oluşturuldu - {len(result['videos'])} video eklendi")
|
logger.info(f"[FEED] ✅ RSS feed oluşturuldu - {added_count} video eklendi, {skipped_count} video atlandı (transcript_clean yok)")
|
||||||
|
|
||||||
# Format'a göre döndür
|
# Format'a göre döndür
|
||||||
response_headers = {}
|
response_headers = {}
|
||||||
|
|||||||
16
test_curl.sh
16
test_curl.sh
@@ -78,6 +78,22 @@ curl -X GET "${BASE_URL}/?channel_id=UCsXVk37bltHxD1rDPwtNM8Q&format=Atom&max_it
|
|||||||
-H "X-API-Key: ${API_KEY}" \
|
-H "X-API-Key: ${API_KEY}" \
|
||||||
-v
|
-v
|
||||||
|
|
||||||
|
echo -e "\n\n=========================================="
|
||||||
|
echo "11. Yeni Kanal Test (UCmGSJVG3mCRXVOP4yZrU1Dw)"
|
||||||
|
echo " Not: İlk istekte 404 alınabilir (transcript henüz işlenmemiş)"
|
||||||
|
echo "=========================================="
|
||||||
|
curl -X GET "${BASE_URL}/?channel_id=UCmGSJVG3mCRXVOP4yZrU1Dw&format=Atom&max_items=5" \
|
||||||
|
-H "X-API-Key: ${API_KEY}" \
|
||||||
|
-v
|
||||||
|
|
||||||
|
echo -e "\n\n=========================================="
|
||||||
|
echo "12. Yeni Kanal URL ile Test"
|
||||||
|
echo " Not: İlk istekte 404 alınabilir (transcript henüz işlenmemiş)"
|
||||||
|
echo "=========================================="
|
||||||
|
curl -X GET "${BASE_URL}/?channel_url=https://youtube.com/channel/UCmGSJVG3mCRXVOP4yZrU1Dw&format=Atom&max_items=5" \
|
||||||
|
-H "X-API-Key: ${API_KEY}" \
|
||||||
|
-v
|
||||||
|
|
||||||
echo -e "\n\n=========================================="
|
echo -e "\n\n=========================================="
|
||||||
echo "Test tamamlandı!"
|
echo "Test tamamlandı!"
|
||||||
echo ""
|
echo ""
|
||||||
|
|||||||
Reference in New Issue
Block a user