KekikStream 1.7.1__py3-none-any.whl → 2.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. KekikStream/Core/Extractor/ExtractorBase.py +20 -9
  2. KekikStream/Core/Extractor/ExtractorLoader.py +25 -17
  3. KekikStream/Core/Extractor/ExtractorManager.py +53 -9
  4. KekikStream/Core/Extractor/ExtractorModels.py +5 -7
  5. KekikStream/Core/Extractor/YTDLPCache.py +35 -0
  6. KekikStream/Core/Media/MediaHandler.py +44 -26
  7. KekikStream/Core/Media/MediaManager.py +0 -3
  8. KekikStream/Core/Plugin/PluginBase.py +82 -22
  9. KekikStream/Core/Plugin/PluginLoader.py +11 -7
  10. KekikStream/Core/Plugin/PluginModels.py +25 -26
  11. KekikStream/Core/__init__.py +1 -0
  12. KekikStream/Extractors/CloseLoad.py +21 -7
  13. KekikStream/Extractors/ContentX.py +21 -6
  14. KekikStream/Extractors/DonilasPlay.py +86 -0
  15. KekikStream/Extractors/DzenRu.py +38 -0
  16. KekikStream/Extractors/ExPlay.py +53 -0
  17. KekikStream/Extractors/Filemoon.py +78 -0
  18. KekikStream/Extractors/HDPlayerSystem.py +41 -0
  19. KekikStream/Extractors/JetTv.py +45 -0
  20. KekikStream/Extractors/MailRu.py +3 -4
  21. KekikStream/Extractors/MixPlayHD.py +2 -3
  22. KekikStream/Extractors/MixTiger.py +57 -0
  23. KekikStream/Extractors/MolyStream.py +5 -5
  24. KekikStream/Extractors/Odnoklassniki.py +13 -7
  25. KekikStream/Extractors/PeaceMakerst.py +10 -5
  26. KekikStream/Extractors/PixelDrain.py +1 -2
  27. KekikStream/Extractors/PlayerFilmIzle.py +65 -0
  28. KekikStream/Extractors/RapidVid.py +23 -8
  29. KekikStream/Extractors/SetPlay.py +66 -0
  30. KekikStream/Extractors/SetPrime.py +45 -0
  31. KekikStream/Extractors/SibNet.py +2 -3
  32. KekikStream/Extractors/Sobreatsesuyp.py +4 -5
  33. KekikStream/Extractors/TRsTX.py +4 -5
  34. KekikStream/Extractors/TauVideo.py +2 -3
  35. KekikStream/Extractors/TurboImgz.py +2 -3
  36. KekikStream/Extractors/TurkeyPlayer.py +34 -0
  37. KekikStream/Extractors/VCTPlay.py +41 -0
  38. KekikStream/Extractors/VidHide.py +81 -0
  39. KekikStream/Extractors/VidMoly.py +55 -34
  40. KekikStream/Extractors/VidMoxy.py +2 -3
  41. KekikStream/Extractors/VidPapi.py +89 -0
  42. KekikStream/Extractors/VideoSeyred.py +3 -4
  43. KekikStream/Extractors/YTDLP.py +211 -0
  44. KekikStream/Extractors/YildizKisaFilm.py +41 -0
  45. KekikStream/Plugins/BelgeselX.py +196 -0
  46. KekikStream/Plugins/DiziBox.py +25 -34
  47. KekikStream/Plugins/DiziPal.py +24 -35
  48. KekikStream/Plugins/DiziYou.py +54 -37
  49. KekikStream/Plugins/Dizilla.py +66 -46
  50. KekikStream/Plugins/FilmBip.py +142 -0
  51. KekikStream/Plugins/FilmMakinesi.py +36 -28
  52. KekikStream/Plugins/FilmModu.py +20 -24
  53. KekikStream/Plugins/FullHDFilm.py +220 -0
  54. KekikStream/Plugins/FullHDFilmizlesene.py +9 -15
  55. KekikStream/Plugins/HDFilmCehennemi.py +141 -69
  56. KekikStream/Plugins/JetFilmizle.py +85 -52
  57. KekikStream/Plugins/KultFilmler.py +217 -0
  58. KekikStream/Plugins/RecTV.py +22 -34
  59. KekikStream/Plugins/RoketDizi.py +222 -0
  60. KekikStream/Plugins/SelcukFlix.py +328 -0
  61. KekikStream/Plugins/SetFilmIzle.py +252 -0
  62. KekikStream/Plugins/SezonlukDizi.py +54 -21
  63. KekikStream/Plugins/SineWix.py +17 -29
  64. KekikStream/Plugins/Sinefy.py +241 -0
  65. KekikStream/Plugins/SinemaCX.py +154 -0
  66. KekikStream/Plugins/Sinezy.py +143 -0
  67. KekikStream/Plugins/SuperFilmGeldi.py +130 -0
  68. KekikStream/Plugins/UgurFilm.py +13 -19
  69. KekikStream/__init__.py +47 -56
  70. KekikStream/requirements.txt +3 -4
  71. kekikstream-2.2.0.dist-info/METADATA +312 -0
  72. kekikstream-2.2.0.dist-info/RECORD +81 -0
  73. KekikStream/Extractors/FourCX.py +0 -7
  74. KekikStream/Extractors/FourPichive.py +0 -7
  75. KekikStream/Extractors/FourPlayRu.py +0 -7
  76. KekikStream/Extractors/HDStreamAble.py +0 -7
  77. KekikStream/Extractors/Hotlinger.py +0 -7
  78. KekikStream/Extractors/OkRuHTTP.py +0 -7
  79. KekikStream/Extractors/OkRuSSL.py +0 -7
  80. KekikStream/Extractors/Pichive.py +0 -7
  81. KekikStream/Extractors/PlayRu.py +0 -7
  82. KekikStream/Extractors/VidMolyMe.py +0 -7
  83. kekikstream-1.7.1.dist-info/METADATA +0 -109
  84. kekikstream-1.7.1.dist-info/RECORD +0 -63
  85. {kekikstream-1.7.1.dist-info → kekikstream-2.2.0.dist-info}/WHEEL +0 -0
  86. {kekikstream-1.7.1.dist-info → kekikstream-2.2.0.dist-info}/entry_points.txt +0 -0
  87. {kekikstream-1.7.1.dist-info → kekikstream-2.2.0.dist-info}/licenses/LICENSE +0 -0
  88. {kekikstream-1.7.1.dist-info → kekikstream-2.2.0.dist-info}/top_level.txt +0 -0
@@ -1,11 +1,11 @@
1
1
  # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
2
2
 
3
3
  from abc import ABC, abstractmethod
4
- from curl_cffi import AsyncSession
5
4
  from cloudscraper import CloudScraper
5
+ from httpx import AsyncClient
6
6
  from typing import Optional
7
7
  from .ExtractorModels import ExtractResult
8
- from urllib.parse import urljoin
8
+ from urllib.parse import urljoin, urlparse
9
9
 
10
10
  class ExtractorBase(ABC):
11
11
  # Çıkarıcının temel özellikleri
@@ -13,24 +13,35 @@ class ExtractorBase(ABC):
13
13
  main_url = ""
14
14
 
15
15
  def __init__(self):
16
- # HTTP istekleri için oturum oluştur
17
- self.cffi = AsyncSession(impersonate="firefox135")
16
+ # cloudscraper - for bypassing Cloudflare
18
17
  self.cloudscraper = CloudScraper()
19
- self.cffi.cookies.update(self.cloudscraper.cookies)
20
- self.cffi.headers.update({"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.7; rv:135.0) Gecko/20100101 Firefox/135.0"})
18
+
19
+ # httpx - lightweight and safe for most HTTP requests
20
+ self.httpx = AsyncClient(timeout = 10)
21
+ self.httpx.headers.update(self.cloudscraper.headers)
22
+ self.httpx.cookies.update(self.cloudscraper.cookies)
23
+ self.httpx.headers.update({
24
+ "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.7; rv:135.0) Gecko/20100101 Firefox/135.0",
25
+ "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
26
+ })
21
27
 
22
28
  def can_handle_url(self, url: str) -> bool:
23
29
  # URL'nin bu çıkarıcı tarafından işlenip işlenemeyeceğini kontrol et
24
30
  return self.main_url in url
25
31
 
32
+ def get_base_url(self, url: str) -> str:
33
+ """URL'den base URL'i çıkar (scheme + netloc)"""
34
+ parsed = urlparse(url)
35
+ return f"{parsed.scheme}://{parsed.netloc}"
36
+
26
37
  @abstractmethod
27
38
  async def extract(self, url: str, referer: Optional[str] = None) -> ExtractResult:
28
39
  # Alt sınıflar tarafından uygulanacak medya çıkarma fonksiyonu
29
40
  pass
30
41
 
31
42
  async def close(self):
32
- # HTTP oturumunu güvenli bir şekilde kapat
33
- await self.cffi.close()
43
+ """Close HTTP client."""
44
+ await self.httpx.aclose()
34
45
 
35
46
  def fix_url(self, url: str) -> str:
36
47
  # Eksik URL'leri düzelt ve tam URL formatına çevir
@@ -40,4 +51,4 @@ class ExtractorBase(ABC):
40
51
  if url.startswith("http") or url.startswith("{\""):
41
52
  return url
42
53
 
43
- return f"https:{url}" if url.startswith("//") else urljoin(self.main_url, url)
54
+ return f"https:{url}" if url.startswith("//") else urljoin(self.main_url, url)
@@ -19,19 +19,22 @@ class ExtractorLoader:
19
19
  def load_all(self) -> list[ExtractorBase]:
20
20
  extractors = []
21
21
 
22
- # Global çıkarıcıları yükle
23
- if self.global_extractors_dir.exists():
24
- # konsol.log(f"[green][*] Global Extractor dizininden yükleniyor: {self.global_extractors_dir}[/green]")
25
- global_extractors = self._load_from_directory(self.global_extractors_dir)
26
- # konsol.log(f"[green]Global Extractor'lar: {[e.__name__ for e in global_extractors]}[/green]")
27
- extractors.extend(global_extractors)
28
-
29
- # Yerel çıkarıcıları yükle
22
+ # Eğer yerel dizinde Extractor varsa, sadece onları yükle (eklenti geliştirme modu)
30
23
  if self.local_extractors_dir.exists():
31
24
  # konsol.log(f"[green][*] Yerel Extractor dizininden yükleniyor: {self.local_extractors_dir}[/green]")
32
25
  local_extractors = self._load_from_directory(self.local_extractors_dir)
33
26
  # konsol.log(f"[green]Yerel Extractor'lar: {[e.__name__ for e in local_extractors]}[/green]")
34
- extractors.extend(local_extractors)
27
+
28
+ if local_extractors:
29
+ # konsol.log("[cyan][*] Yerel Extractor bulundu, global Extractor'lar atlanıyor (eklenti geliştirme modu)[/cyan]")
30
+ extractors.extend(local_extractors)
31
+
32
+ # Yerel dizinde Extractor yoksa, global'leri yükle
33
+ if not extractors and self.global_extractors_dir.exists():
34
+ # konsol.log(f"[green][*] Global Extractor dizininden yükleniyor: {self.global_extractors_dir}[/green]")
35
+ global_extractors = self._load_from_directory(self.global_extractors_dir)
36
+ # konsol.log(f"[green]Global Extractor'lar: {[e.__name__ for e in global_extractors]}[/green]")
37
+ extractors.extend(global_extractors)
35
38
 
36
39
  # Benzersizliği sağlama (modül adı + sınıf adı bazında)
37
40
  unique_extractors = []
@@ -57,9 +60,10 @@ class ExtractorLoader:
57
60
  if file.endswith(".py") and not file.startswith("__"):
58
61
  module_name = file[:-3] # .py uzantısını kaldır
59
62
  # konsol.log(f"[cyan]Okunan Dosya\t\t: {module_name}[/cyan]")
60
- if extractor := self._load_extractor(directory, module_name):
61
- # konsol.log(f"[magenta]Extractor Yüklendi\t: {extractor.__name__}[/magenta]")
62
- extractors.append(extractor)
63
+ module_extractors = self._load_extractor(directory, module_name)
64
+ if module_extractors:
65
+ # konsol.log(f"[magenta]Extractor Yüklendi\t: {[e.__name__ for e in module_extractors]}[/magenta]")
66
+ extractors.extend(module_extractors)
63
67
 
64
68
  # konsol.log(f"[yellow]{directory} dizininden yüklenen Extractor'lar: {[e.__name__ for e in extractors]}[/yellow]")
65
69
  return extractors
@@ -70,21 +74,25 @@ class ExtractorLoader:
70
74
  path = directory / f"{module_name}.py"
71
75
  spec = importlib.util.spec_from_file_location(module_name, path)
72
76
  if not spec or not spec.loader:
73
- return None
77
+ return []
74
78
 
75
79
  # Modülü içe aktar
76
80
  module = importlib.util.module_from_spec(spec)
77
81
  spec.loader.exec_module(module)
78
82
 
79
- # Yalnızca doğru modülden gelen ExtractorBase sınıflarını yükle
83
+ # Yalnızca doğru modülden gelen ExtractorBase sınıflarını yükle (TÜM CLASS'LAR)
84
+ extractors = []
80
85
  for attr in dir(module):
81
86
  obj = getattr(module, attr)
82
- if obj.__module__ == module_name and isinstance(obj, type) and issubclass(obj, ExtractorBase) and obj is not ExtractorBase:
87
+ # isinstance kontrolünü __module__ kontrolünden ÖNCE yap
88
+ if isinstance(obj, type) and issubclass(obj, ExtractorBase) and obj is not ExtractorBase and obj.__module__ == module_name:
83
89
  # konsol.log(f"[green]Yüklenen sınıf\t\t: {module_name}.{obj.__name__} ({obj.__module__}.{obj.__name__})[/green]")
84
- return obj
90
+ extractors.append(obj)
91
+
92
+ return extractors
85
93
 
86
94
  except Exception as hata:
87
95
  konsol.log(f"[red][!] Extractor yüklenirken hata oluştu: {module_name}\nHata: {hata}")
88
96
  konsol.print(f"[dim]{traceback.format_exc()}[/dim]")
89
97
 
90
- return None
98
+ return []
@@ -7,25 +7,69 @@ class ExtractorManager:
7
7
  def __init__(self, extractor_dir="Extractors"):
8
8
  # Çıkarıcı yükleyiciyi başlat ve tüm çıkarıcıları yükle
9
9
  self.extractor_loader = ExtractorLoader(extractor_dir)
10
- self.extractors = self.extractor_loader.load_all()
10
+ self.extractors = self.extractor_loader.load_all() # Sadece class'lar
11
11
 
12
- def find_extractor(self, link) -> ExtractorBase:
13
- # Verilen bağlantıyı işleyebilecek çıkarıcıyı bul
12
+ # Lazy loading: Instance'lar ilk kullanımda oluşturulacak
13
+ self._extractor_instances = None # None = henüz oluşturulmadı
14
+ self._ytdlp_extractor = None
15
+ self._initialized = False
16
+
17
+ def _ensure_initialized(self):
18
+ """
19
+ Lazy initialization: İlk kullanımda TÜM extractorları initialize et
20
+
21
+ Startup'ta sadece class'ları yükledik (hızlı).
22
+ Şimdi instance'ları oluştur ve cache'le (bir kere).
23
+ """
24
+ if self._initialized:
25
+ return
26
+
27
+ # Instance listesi oluştur
28
+ self._extractor_instances = []
29
+
30
+ # TÜM extractorları instance'la
14
31
  for extractor_cls in self.extractors:
15
- extractor:ExtractorBase = extractor_cls()
32
+ instance = extractor_cls()
33
+
34
+ # YTDLP'yi ayrı tut
35
+ if instance.name == "yt-dlp":
36
+ self._ytdlp_extractor = instance
37
+ else:
38
+ self._extractor_instances.append(instance)
39
+
40
+ # YTDLP'yi EN BAŞA ekle
41
+ if self._ytdlp_extractor:
42
+ self._extractor_instances.insert(0, self._ytdlp_extractor)
43
+
44
+ self._initialized = True
45
+
46
+ def find_extractor(self, link) -> ExtractorBase:
47
+ """
48
+ Verilen bağlantıyı işleyebilecek çıkarıcıyı bul
49
+ """
50
+ # Lazy loading: İlk kullanımda extractorları initialize et
51
+ self._ensure_initialized()
52
+
53
+ # Cached instance'ları kullan
54
+ for extractor in self._extractor_instances:
16
55
  if extractor.can_handle_url(link):
17
56
  return extractor
18
57
 
19
58
  return None
20
59
 
21
60
  def map_links_to_extractors(self, links) -> dict:
22
- # Bağlantıları uygun çıkarıcılarla eşleştir
61
+ """
62
+ Bağlantıları uygun çıkarıcılarla eşleştir
63
+ """
64
+ # Lazy loading: İlk kullanımda extractorları initialize et
65
+ self._ensure_initialized()
66
+
23
67
  mapping = {}
24
68
  for link in links:
25
- for extractor_cls in self.extractors:
26
- extractor:ExtractorBase = extractor_cls()
69
+ # Cached instance'ları kullan
70
+ for extractor in self._extractor_instances:
27
71
  if extractor.can_handle_url(link):
28
72
  mapping[link] = f"{extractor.name:<30} » {link.replace(extractor.main_url, '')}"
29
- break
73
+ break # İlk eşleşmede dur
30
74
 
31
- return mapping
75
+ return mapping
@@ -1,8 +1,6 @@
1
1
  # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
2
2
 
3
3
  from pydantic import BaseModel
4
- from typing import List, Optional
5
-
6
4
 
7
5
  class Subtitle(BaseModel):
8
6
  """Altyazı modeli."""
@@ -12,8 +10,8 @@ class Subtitle(BaseModel):
12
10
 
13
11
  class ExtractResult(BaseModel):
14
12
  """Extractor'ın döndürmesi gereken sonuç modeli."""
15
- name : str
16
- url : str
17
- referer : str
18
- headers : Optional[dict] = {}
19
- subtitles : List[Subtitle] = []
13
+ name : str
14
+ url : str
15
+ referer : str | None = None
16
+ user_agent : str | None = None
17
+ subtitles : list[Subtitle] = []
@@ -0,0 +1,35 @@
1
+ # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
2
+
3
+ from Kekik.cli import konsol
4
+ from yt_dlp.extractor import gen_extractors
5
+
6
+ # Global cache (module-level singleton)
7
+ _YTDLP_EXTRACTORS_CACHE = None
8
+ _CACHE_INITIALIZED = False
9
+
10
+ def get_ytdlp_extractors() -> list:
11
+ """
12
+ yt-dlp extractorlarını cache'le ve döndür
13
+
14
+ Returns:
15
+ list: yt-dlp extractor sınıfları
16
+ """
17
+ global _YTDLP_EXTRACTORS_CACHE, _CACHE_INITIALIZED
18
+
19
+ if _CACHE_INITIALIZED:
20
+ return _YTDLP_EXTRACTORS_CACHE
21
+
22
+ try:
23
+ extractors = list(gen_extractors())
24
+ extractors = [ie for ie in extractors if ie.ie_key() != 'Generic']
25
+
26
+ _YTDLP_EXTRACTORS_CACHE = extractors
27
+ _CACHE_INITIALIZED = True
28
+
29
+ return extractors
30
+
31
+ except Exception as e:
32
+ konsol.log(f"[red][⚠] yt-dlp extractor cache hatası: {e}[/red]")
33
+ _YTDLP_EXTRACTORS_CACHE = []
34
+ _CACHE_INITIALIZED = True
35
+ return []
@@ -5,36 +5,47 @@ from ..Extractor.ExtractorModels import ExtractResult
5
5
  import subprocess, os
6
6
 
7
7
  class MediaHandler:
8
- def __init__(self, title: str = "KekikStream", headers: dict = None):
9
- # Varsayılan HTTP başlıklarını ayarla
10
- if headers is None:
11
- headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5)"}
12
-
13
- self.headers = headers
8
+ def __init__(self, title: str = "KekikStream"):
14
9
  self.title = title
10
+ self.headers = {}
15
11
 
16
12
  def play_media(self, extract_data: ExtractResult):
17
- # Referer varsa headers'a ekle
18
- if extract_data.referer:
19
- self.headers.update({"Referer": extract_data.referer})
13
+ # user-agent ekle (varsayılan veya extract_data'dan)
14
+ user_agent = extract_data.user_agent or "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_5)"
15
+ self.headers["user-agent"] = user_agent
20
16
 
21
- # ExtractResult'tan gelen headers'ları ekle
22
- if extract_data.headers:
23
- self.headers.update(extract_data.headers)
17
+ # referer ekle
18
+ if extract_data.referer:
19
+ self.headers["referer"] = extract_data.referer
24
20
 
25
- # Google Drive gibi özel durumlar için yt-dlp kullan
26
- if self.headers.get("User-Agent") in ["googleusercontent", "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"]:
21
+ # Özel Durumlar (RecTV vs. Googleusercontent)
22
+ if user_agent in ["googleusercontent", "Mozilla/5.0 (X11; Linux x86_64; rv:101.0) Gecko/20100101 Firefox/101.0"]:
27
23
  return self.play_with_ytdlp(extract_data)
28
24
 
29
- # İşletim sistemine göre oynatıcı seç
25
+ # İşletim sistemine göre oynatıcı seç (Android durumu)
30
26
  if subprocess.check_output(['uname', '-o']).strip() == b'Android':
31
27
  return self.play_with_android_mxplayer(extract_data)
32
28
 
33
- # Cookie veya alt yazılar varsa mpv kullan
34
- if "Cookie" in self.headers or extract_data.subtitles:
35
- return self.play_with_mpv(extract_data)
29
+ # Oynatıcı öncelik sırası (fallback zincirleme)
30
+ players = [
31
+ ("MPV", self.play_with_mpv),
32
+ ("VLC", self.play_with_vlc),
33
+ ("yt-dlp", self.play_with_ytdlp)
34
+ ]
36
35
 
37
- return self.play_with_vlc(extract_data) or self.play_with_mpv(extract_data)
36
+ # Fallback zincirleme
37
+ for player_name, player_func in players:
38
+ try:
39
+ result = player_func(extract_data)
40
+ if result or result is None: # None = MPV (exception yok)
41
+ konsol.log(f"[green][✓] {player_name} ile başarılı[/green]")
42
+ return True
43
+ except Exception as e:
44
+ konsol.log(f"[yellow][⚠] {player_name} hatası: {e}[/yellow]")
45
+ continue
46
+
47
+ konsol.print("[red][✗] Hiçbir oynatıcı çalışmadı![/red]")
48
+ return False
38
49
 
39
50
  def play_with_vlc(self, extract_data: ExtractResult):
40
51
  konsol.log(f"[yellow][»] VLC ile Oynatılıyor : {extract_data.url}")
@@ -48,11 +59,11 @@ class MediaHandler:
48
59
  f"--input-title-format={self.title}"
49
60
  ])
50
61
 
51
- if "User-Agent" in self.headers:
52
- vlc_command.append(f"--http-user-agent={self.headers.get('User-Agent')}")
62
+ if "user-agent" in self.headers:
63
+ vlc_command.append(f"--http-user-agent={self.headers.get('user-agent')}")
53
64
 
54
- if "Referer" in self.headers:
55
- vlc_command.append(f"--http-referrer={self.headers.get('Referer')}")
65
+ if "referer" in self.headers:
66
+ vlc_command.append(f"--http-referrer={self.headers.get('referer')}")
56
67
 
57
68
  vlc_command.extend(
58
69
  f"--sub-file={subtitle.url}" for subtitle in extract_data.subtitles
@@ -92,12 +103,15 @@ class MediaHandler:
92
103
  with open(os.devnull, "w") as devnull:
93
104
  subprocess.run(mpv_command, stdout=devnull, stderr=devnull, check=True)
94
105
 
106
+ return True
95
107
  except subprocess.CalledProcessError as hata:
96
108
  konsol.print(f"[red]mpv oynatma hatası: {hata}[/red]")
97
109
  konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
110
+ return False
98
111
  except FileNotFoundError:
99
112
  konsol.print("[red]mpv bulunamadı! mpv kurulu olduğundan emin olun.[/red]")
100
113
  konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
114
+ return False
101
115
 
102
116
  def play_with_ytdlp(self, extract_data: ExtractResult):
103
117
  konsol.log(f"[yellow][»] yt-dlp ile Oynatılıyor : {extract_data.url}")
@@ -125,12 +139,15 @@ class MediaHandler:
125
139
  with subprocess.Popen(ytdlp_command, stdout=subprocess.PIPE) as ytdlp_proc:
126
140
  subprocess.run(mpv_command, stdin=ytdlp_proc.stdout, check=True)
127
141
 
142
+ return True
128
143
  except subprocess.CalledProcessError as hata:
129
144
  konsol.print(f"[red]Oynatma hatası: {hata}[/red]")
130
145
  konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
146
+ return False
131
147
  except FileNotFoundError:
132
148
  konsol.print("[red]yt-dlp veya mpv bulunamadı! Kurulumlarından emin olun.[/red]")
133
149
  konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
150
+ return False
134
151
 
135
152
  def play_with_android_mxplayer(self, extract_data: ExtractResult):
136
153
  konsol.log(f"[yellow][»] MxPlayer ile Oynatılıyor : {extract_data.url}")
@@ -155,11 +172,12 @@ class MediaHandler:
155
172
  with open(os.devnull, "w") as devnull:
156
173
  subprocess.run(android_command, stdout=devnull, stderr=devnull, check=True)
157
174
 
158
- return
159
-
175
+ return True
160
176
  except subprocess.CalledProcessError as hata:
161
177
  konsol.print(f"[red]{paket} oynatma hatası: {hata}[/red]")
162
178
  konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
179
+ return False
163
180
  except FileNotFoundError:
164
181
  konsol.print(f"Paket: {paket}, Hata: MX Player kurulu değil")
165
- konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
182
+ konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
183
+ return False
@@ -12,8 +12,5 @@ class MediaManager:
12
12
  def get_title(self):
13
13
  return self.media_handler.title
14
14
 
15
- def set_headers(self, headers):
16
- self.media_handler.headers.update(headers)
17
-
18
15
  def play_media(self, extract_data):
19
16
  self.media_handler.play_media(extract_data)
@@ -1,11 +1,13 @@
1
1
  # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
2
2
 
3
+ from ...CLI import konsol
3
4
  from abc import ABC, abstractmethod
4
- from curl_cffi import AsyncSession
5
5
  from cloudscraper import CloudScraper
6
- from .PluginModels import MainPageResult, SearchResult, MovieInfo
6
+ from httpx import AsyncClient
7
+ from .PluginModels import MainPageResult, SearchResult, MovieInfo, SeriesInfo
7
8
  from ..Media.MediaHandler import MediaHandler
8
9
  from ..Extractor.ExtractorManager import ExtractorManager
10
+ from ..Extractor.ExtractorModels import ExtractResult
9
11
  from urllib.parse import urljoin
10
12
  import re
11
13
 
@@ -24,17 +26,28 @@ class PluginBase(ABC):
24
26
  self.main_url = new_url
25
27
 
26
28
  def __init__(self):
27
- self.cffi = AsyncSession(impersonate="firefox135")
29
+ # cloudscraper - for bypassing Cloudflare
28
30
  self.cloudscraper = CloudScraper()
29
- self.cffi.cookies.update(self.cloudscraper.cookies)
30
- self.cffi.headers.update({"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.7; rv:135.0) Gecko/20100101 Firefox/135.0"})
31
+
32
+ # httpx - lightweight and safe for most HTTP requests
33
+ self.httpx = AsyncClient(
34
+ timeout = 3,
35
+ follow_redirects = True
36
+ )
37
+ self.httpx.headers.update(self.cloudscraper.headers)
38
+ self.httpx.cookies.update(self.cloudscraper.cookies)
39
+ self.httpx.headers.update({
40
+ "User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.7; rv:135.0) Gecko/20100101 Firefox/135.0",
41
+ "Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
42
+ })
43
+
31
44
  self.media_handler = MediaHandler()
32
45
  self.ex_manager = ExtractorManager()
33
46
 
34
- # @abstractmethod
35
- # async def get_main_page(self, page: int, url: str, category: str) -> list[MainPageResult]:
36
- # """Ana sayfadaki popüler içerikleri döndürür."""
37
- # pass
47
+ @abstractmethod
48
+ async def get_main_page(self, page: int, url: str, category: str) -> list[MainPageResult]:
49
+ """Ana sayfadaki popüler içerikleri döndürür."""
50
+ pass
38
51
 
39
52
  @abstractmethod
40
53
  async def search(self, query: str) -> list[SearchResult]:
@@ -42,37 +55,38 @@ class PluginBase(ABC):
42
55
  pass
43
56
 
44
57
  @abstractmethod
45
- async def load_item(self, url: str) -> MovieInfo:
58
+ async def load_item(self, url: str) -> MovieInfo | SeriesInfo:
46
59
  """Bir medya öğesi hakkında detaylı bilgi döndürür."""
47
60
  pass
48
61
 
49
62
  @abstractmethod
50
- async def load_links(self, url: str) -> list[dict]:
63
+ async def load_links(self, url: str) -> list[ExtractResult]:
51
64
  """
52
65
  Bir medya öğesi için oynatma bağlantılarını döndürür.
53
-
66
+
54
67
  Args:
55
68
  url: Medya URL'si
56
-
69
+
57
70
  Returns:
58
- Dictionary listesi, her biri şu alanları içerir:
71
+ ExtractResult listesi, her biri şu alanları içerir:
59
72
  - url (str, zorunlu): Video URL'si
60
73
  - name (str, zorunlu): Gösterim adı (tüm bilgileri içerir)
61
74
  - referer (str, opsiyonel): Referer header
62
- - subtitles (list, opsiyonel): Altyazı listesi
63
-
75
+ - subtitles (list[Subtitle], opsiyonel): Altyazı listesi
76
+
64
77
  Example:
65
78
  [
66
- {
67
- "url": "https://example.com/video.m3u8",
68
- "name": "HDFilmCehennemi | 1080p TR Dublaj"
69
- }
79
+ ExtractResult(
80
+ url="https://example.com/video.m3u8",
81
+ name="HDFilmCehennemi | 1080p TR Dublaj"
82
+ )
70
83
  ]
71
84
  """
72
85
  pass
73
86
 
74
87
  async def close(self):
75
- await self.cffi.close()
88
+ """Close HTTP client."""
89
+ await self.httpx.aclose()
76
90
 
77
91
  def fix_url(self, url: str) -> str:
78
92
  if not url:
@@ -83,6 +97,40 @@ class PluginBase(ABC):
83
97
 
84
98
  return f"https:{url}" if url.startswith("//") else urljoin(self.main_url, url)
85
99
 
100
+ async def extract(self, url: str, referer: str = None, prefix: str | None = None) -> ExtractResult | None:
101
+ """
102
+ Extractor ile video URL'sini çıkarır.
103
+
104
+ Args:
105
+ url: Iframe veya video URL'si
106
+ referer: Referer header (varsayılan: plugin main_url)
107
+ prefix: İsmin başına eklenecek opsiyonel etiket (örn: "Türkçe Dublaj")
108
+
109
+ Returns:
110
+ ExtractResult: Extractor sonucu (name prefix ile birleştirilmiş) veya None
111
+
112
+ Extractor bulunamadığında veya hata oluştuğunda uyarı verir.
113
+ """
114
+ if referer is None:
115
+ referer = f"{self.main_url}/"
116
+
117
+ extractor = self.ex_manager.find_extractor(url)
118
+ if not extractor:
119
+ konsol.log(f"[magenta][?] {self.name} » Extractor bulunamadı: {url}")
120
+ return None
121
+
122
+ try:
123
+ data = await extractor.extract(url, referer=referer)
124
+
125
+ # prefix varsa name'e ekle
126
+ if prefix and data.name:
127
+ data.name = f"{prefix} | {data.name}"
128
+
129
+ return data
130
+ except Exception as hata:
131
+ konsol.log(f"[red][!] {self.name} » Extractor hatası ({extractor.name}): {hata}")
132
+ return None
133
+
86
134
  @staticmethod
87
135
  def clean_title(title: str) -> str:
88
136
  suffixes = [
@@ -107,4 +155,16 @@ class PluginBase(ABC):
107
155
  for suffix in suffixes:
108
156
  cleaned_title = re.sub(f"{re.escape(suffix)}.*$", "", cleaned_title, flags=re.IGNORECASE).strip()
109
157
 
110
- return cleaned_title
158
+ return cleaned_title
159
+
160
+ async def play(self, **kwargs):
161
+ """
162
+ Varsayılan oynatma metodu.
163
+ Tüm pluginlerde ortak kullanılır.
164
+ """
165
+ extract_result = ExtractResult(**kwargs)
166
+ self.media_handler.title = kwargs.get("name")
167
+ if self.name not in self.media_handler.title:
168
+ self.media_handler.title = f"{self.name} | {self.media_handler.title}"
169
+
170
+ self.media_handler.play_media(extract_result)
@@ -19,15 +19,19 @@ class PluginLoader:
19
19
  def load_all(self) -> dict[str, PluginBase]:
20
20
  plugins = {}
21
21
 
22
- # Global eklentileri yükle
23
- if self.global_plugins_dir.exists():
24
- # konsol.log(f"[green][*] Global Eklenti dizininden yükleniyor: {self.global_plugins_dir}[/green]")
25
- plugins |= self._load_from_directory(self.global_plugins_dir)
26
-
27
- # Yerel eklentileri yükle
22
+ # Eğer yerel dizinde Plugin varsa, sadece onları yükle (eklenti geliştirme modu)
28
23
  if self.local_plugins_dir.exists():
29
24
  # konsol.log(f"[green][*] Yerel Eklenti dizininden yükleniyor: {self.local_plugins_dir}[/green]")
30
- plugins |= self._load_from_directory(self.local_plugins_dir)
25
+ local_plugins = self._load_from_directory(self.local_plugins_dir)
26
+
27
+ if local_plugins:
28
+ # konsol.log("[cyan][*] Yerel Plugin bulundu, global Plugin'ler atlanıyor (eklenti geliştirme modu)[/cyan]")
29
+ plugins |= local_plugins
30
+
31
+ # Yerel dizinde Plugin yoksa, global'leri yükle
32
+ if not plugins and self.global_plugins_dir.exists():
33
+ # konsol.log(f"[green][*] Global Eklenti dizininden yükleniyor: {self.global_plugins_dir}[/green]")
34
+ plugins |= self._load_from_directory(self.global_plugins_dir)
31
35
 
32
36
  if not plugins:
33
37
  konsol.print("[yellow][!] Yüklenecek bir Eklenti bulunamadı![/yellow]")