KekikStream 1.4.4__py3-none-any.whl → 2.0.2__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.
- KekikStream/CLI/pypi_kontrol.py +6 -6
- KekikStream/Core/Extractor/ExtractorBase.py +13 -12
- KekikStream/Core/Extractor/ExtractorLoader.py +25 -17
- KekikStream/Core/Extractor/ExtractorManager.py +53 -9
- KekikStream/Core/Extractor/ExtractorModels.py +5 -7
- KekikStream/Core/Extractor/YTDLPCache.py +35 -0
- KekikStream/Core/Media/MediaHandler.py +52 -31
- KekikStream/Core/Media/MediaManager.py +0 -3
- KekikStream/Core/Plugin/PluginBase.py +47 -21
- KekikStream/Core/Plugin/PluginLoader.py +11 -7
- KekikStream/Core/Plugin/PluginModels.py +25 -25
- KekikStream/Core/__init__.py +1 -0
- KekikStream/Extractors/CloseLoad.py +6 -26
- KekikStream/Extractors/ContentX_.py +40 -0
- KekikStream/Extractors/DzenRu.py +38 -0
- KekikStream/Extractors/ExPlay.py +53 -0
- KekikStream/Extractors/FirePlayer.py +60 -0
- KekikStream/Extractors/HDPlayerSystem.py +41 -0
- KekikStream/Extractors/JetTv.py +45 -0
- KekikStream/Extractors/MailRu.py +2 -4
- KekikStream/Extractors/MixTiger.py +57 -0
- KekikStream/Extractors/MolyStream.py +25 -7
- KekikStream/Extractors/Odnoklassniki.py +16 -11
- KekikStream/Extractors/{OkRuHTTP.py → Odnoklassniki_.py} +5 -1
- KekikStream/Extractors/{HDStreamAble.py → PeaceMakerst_.py} +1 -1
- KekikStream/Extractors/PixelDrain.py +0 -1
- KekikStream/Extractors/PlayerFilmIzle.py +62 -0
- KekikStream/Extractors/RapidVid.py +30 -13
- KekikStream/Extractors/RapidVid_.py +7 -0
- KekikStream/Extractors/SetPlay.py +57 -0
- KekikStream/Extractors/SetPrime.py +45 -0
- KekikStream/Extractors/SibNet.py +0 -1
- KekikStream/Extractors/TurkeyPlayer.py +34 -0
- KekikStream/Extractors/VidHide.py +72 -0
- KekikStream/Extractors/VidMoly.py +20 -19
- KekikStream/Extractors/{VidMolyMe.py → VidMoly_.py} +1 -1
- KekikStream/Extractors/VidMoxy.py +0 -1
- KekikStream/Extractors/VidPapi.py +89 -0
- KekikStream/Extractors/YTDLP.py +177 -0
- KekikStream/Extractors/YildizKisaFilm.py +41 -0
- KekikStream/Plugins/DiziBox.py +28 -16
- KekikStream/Plugins/DiziPal.py +246 -0
- KekikStream/Plugins/DiziYou.py +58 -31
- KekikStream/Plugins/Dizilla.py +97 -68
- KekikStream/Plugins/FilmBip.py +145 -0
- KekikStream/Plugins/FilmMakinesi.py +61 -52
- KekikStream/Plugins/FilmModu.py +138 -0
- KekikStream/Plugins/FullHDFilm.py +164 -0
- KekikStream/Plugins/FullHDFilmizlesene.py +38 -37
- KekikStream/Plugins/HDFilmCehennemi.py +44 -54
- KekikStream/Plugins/JetFilmizle.py +68 -42
- KekikStream/Plugins/KultFilmler.py +219 -0
- KekikStream/Plugins/RecTV.py +41 -37
- KekikStream/Plugins/RoketDizi.py +232 -0
- KekikStream/Plugins/SelcukFlix.py +309 -0
- KekikStream/Plugins/SezonlukDizi.py +16 -14
- KekikStream/Plugins/SineWix.py +39 -30
- KekikStream/Plugins/Sinefy.py +238 -0
- KekikStream/Plugins/SinemaCX.py +157 -0
- KekikStream/Plugins/Sinezy.py +146 -0
- KekikStream/Plugins/SuperFilmGeldi.py +121 -0
- KekikStream/Plugins/UgurFilm.py +10 -10
- KekikStream/__init__.py +296 -319
- KekikStream/requirements.txt +3 -4
- kekikstream-2.0.2.dist-info/METADATA +309 -0
- kekikstream-2.0.2.dist-info/RECORD +82 -0
- {kekikstream-1.4.4.dist-info → kekikstream-2.0.2.dist-info}/WHEEL +1 -1
- KekikStream/Extractors/FourCX.py +0 -7
- KekikStream/Extractors/FourPichive.py +0 -7
- KekikStream/Extractors/FourPlayRu.py +0 -7
- KekikStream/Extractors/Hotlinger.py +0 -7
- KekikStream/Extractors/OkRuSSL.py +0 -7
- KekikStream/Extractors/Pichive.py +0 -7
- KekikStream/Extractors/PlayRu.py +0 -7
- KekikStream/Helpers/Unpack.py +0 -75
- KekikStream/Plugins/Shorten.py +0 -225
- kekikstream-1.4.4.dist-info/METADATA +0 -108
- kekikstream-1.4.4.dist-info/RECORD +0 -63
- {kekikstream-1.4.4.dist-info → kekikstream-2.0.2.dist-info}/entry_points.txt +0 -0
- {kekikstream-1.4.4.dist-info → kekikstream-2.0.2.dist-info/licenses}/LICENSE +0 -0
- {kekikstream-1.4.4.dist-info → kekikstream-2.0.2.dist-info}/top_level.txt +0 -0
KekikStream/CLI/pypi_kontrol.py
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
# Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
2
|
|
|
3
|
-
from .
|
|
4
|
-
from rich.panel
|
|
5
|
-
from
|
|
6
|
-
from requests
|
|
7
|
-
from subprocess
|
|
3
|
+
from . import konsol
|
|
4
|
+
from rich.panel import Panel
|
|
5
|
+
from importlib import metadata
|
|
6
|
+
from requests import get
|
|
7
|
+
from subprocess import check_call
|
|
8
8
|
import sys
|
|
9
9
|
|
|
10
10
|
def pypi_kontrol_guncelle(paket_adi: str):
|
|
11
11
|
try:
|
|
12
12
|
konsol.print(f"[bold cyan] {paket_adi} Güncellemesi kontrol ediliyor...[/bold cyan]")
|
|
13
|
-
mevcut_surum =
|
|
13
|
+
mevcut_surum = metadata.version(paket_adi)
|
|
14
14
|
konsol.print(Panel(f"[cyan]Yüklü sürüm:[/cyan] [bold yellow]{mevcut_surum}[/bold yellow]"))
|
|
15
15
|
|
|
16
16
|
istek = get(f"https://pypi.org/pypi/{paket_adi}/json")
|
|
@@ -1,8 +1,8 @@
|
|
|
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 httpx import AsyncClient, Timeout
|
|
5
4
|
from cloudscraper import CloudScraper
|
|
5
|
+
from httpx import AsyncClient
|
|
6
6
|
from typing import Optional
|
|
7
7
|
from .ExtractorModels import ExtractResult
|
|
8
8
|
from urllib.parse import urljoin
|
|
@@ -13,16 +13,17 @@ class ExtractorBase(ABC):
|
|
|
13
13
|
main_url = ""
|
|
14
14
|
|
|
15
15
|
def __init__(self):
|
|
16
|
-
#
|
|
17
|
-
self.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
16
|
+
# cloudscraper - for bypassing Cloudflare
|
|
17
|
+
self.cloudscraper = CloudScraper()
|
|
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
|
+
})
|
|
26
27
|
|
|
27
28
|
def can_handle_url(self, url: str) -> bool:
|
|
28
29
|
# URL'nin bu çıkarıcı tarafından işlenip işlenemeyeceğini kontrol et
|
|
@@ -34,7 +35,7 @@ class ExtractorBase(ABC):
|
|
|
34
35
|
pass
|
|
35
36
|
|
|
36
37
|
async def close(self):
|
|
37
|
-
|
|
38
|
+
"""Close HTTP client."""
|
|
38
39
|
await self.httpx.aclose()
|
|
39
40
|
|
|
40
41
|
def fix_url(self, url: str) -> str:
|
|
@@ -19,19 +19,22 @@ class ExtractorLoader:
|
|
|
19
19
|
def load_all(self) -> list[ExtractorBase]:
|
|
20
20
|
extractors = []
|
|
21
21
|
|
|
22
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
-
|
|
13
|
-
#
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
26
|
-
|
|
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
|
|
16
|
-
url
|
|
17
|
-
referer
|
|
18
|
-
|
|
19
|
-
|
|
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,40 +5,51 @@ from ..Extractor.ExtractorModels import ExtractResult
|
|
|
5
5
|
import subprocess, os
|
|
6
6
|
|
|
7
7
|
class MediaHandler:
|
|
8
|
-
def __init__(self, title: str = "KekikStream"
|
|
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
|
-
#
|
|
18
|
-
|
|
19
|
-
|
|
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
|
-
#
|
|
22
|
-
if extract_data.
|
|
23
|
-
self.headers
|
|
17
|
+
# referer ekle
|
|
18
|
+
if extract_data.referer:
|
|
19
|
+
self.headers["referer"] = extract_data.referer
|
|
24
20
|
|
|
25
|
-
#
|
|
26
|
-
if
|
|
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
|
-
#
|
|
34
|
-
|
|
35
|
-
|
|
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
|
-
|
|
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}")
|
|
41
|
-
konsol.print(self.headers)
|
|
52
|
+
# konsol.print(self.headers)
|
|
42
53
|
try:
|
|
43
54
|
vlc_command = ["vlc", "--quiet"]
|
|
44
55
|
|
|
@@ -48,11 +59,11 @@ class MediaHandler:
|
|
|
48
59
|
f"--input-title-format={self.title}"
|
|
49
60
|
])
|
|
50
61
|
|
|
51
|
-
if "
|
|
52
|
-
vlc_command.append(f"--http-user-agent={self.headers.get('
|
|
62
|
+
if "user-agent" in self.headers:
|
|
63
|
+
vlc_command.append(f"--http-user-agent={self.headers.get('user-agent')}")
|
|
53
64
|
|
|
54
|
-
if "
|
|
55
|
-
vlc_command.append(f"--http-referrer={self.headers.get('
|
|
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
|
|
@@ -62,16 +73,19 @@ class MediaHandler:
|
|
|
62
73
|
with open(os.devnull, "w") as devnull:
|
|
63
74
|
subprocess.run(vlc_command, stdout=devnull, stderr=devnull, check=True)
|
|
64
75
|
|
|
76
|
+
return True
|
|
65
77
|
except subprocess.CalledProcessError as hata:
|
|
66
78
|
konsol.print(f"[red]VLC oynatma hatası: {hata}[/red]")
|
|
67
79
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
80
|
+
return False
|
|
68
81
|
except FileNotFoundError:
|
|
69
82
|
konsol.print("[red]VLC bulunamadı! VLC kurulu olduğundan emin olun.[/red]")
|
|
70
|
-
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
83
|
+
# konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
84
|
+
return False
|
|
71
85
|
|
|
72
86
|
def play_with_mpv(self, extract_data: ExtractResult):
|
|
73
87
|
konsol.log(f"[yellow][»] MPV ile Oynatılıyor : {extract_data.url}")
|
|
74
|
-
konsol.print(self.headers)
|
|
88
|
+
# konsol.print(self.headers)
|
|
75
89
|
try:
|
|
76
90
|
mpv_command = ["mpv"]
|
|
77
91
|
|
|
@@ -89,16 +103,19 @@ class MediaHandler:
|
|
|
89
103
|
with open(os.devnull, "w") as devnull:
|
|
90
104
|
subprocess.run(mpv_command, stdout=devnull, stderr=devnull, check=True)
|
|
91
105
|
|
|
106
|
+
return True
|
|
92
107
|
except subprocess.CalledProcessError as hata:
|
|
93
108
|
konsol.print(f"[red]mpv oynatma hatası: {hata}[/red]")
|
|
94
109
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
110
|
+
return False
|
|
95
111
|
except FileNotFoundError:
|
|
96
112
|
konsol.print("[red]mpv bulunamadı! mpv kurulu olduğundan emin olun.[/red]")
|
|
97
113
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
114
|
+
return False
|
|
98
115
|
|
|
99
116
|
def play_with_ytdlp(self, extract_data: ExtractResult):
|
|
100
117
|
konsol.log(f"[yellow][»] yt-dlp ile Oynatılıyor : {extract_data.url}")
|
|
101
|
-
konsol.print(self.headers)
|
|
118
|
+
# konsol.print(self.headers)
|
|
102
119
|
try:
|
|
103
120
|
ytdlp_command = ["yt-dlp", "--quiet", "--no-warnings"]
|
|
104
121
|
|
|
@@ -122,16 +139,19 @@ class MediaHandler:
|
|
|
122
139
|
with subprocess.Popen(ytdlp_command, stdout=subprocess.PIPE) as ytdlp_proc:
|
|
123
140
|
subprocess.run(mpv_command, stdin=ytdlp_proc.stdout, check=True)
|
|
124
141
|
|
|
142
|
+
return True
|
|
125
143
|
except subprocess.CalledProcessError as hata:
|
|
126
144
|
konsol.print(f"[red]Oynatma hatası: {hata}[/red]")
|
|
127
145
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
146
|
+
return False
|
|
128
147
|
except FileNotFoundError:
|
|
129
148
|
konsol.print("[red]yt-dlp veya mpv bulunamadı! Kurulumlarından emin olun.[/red]")
|
|
130
149
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
150
|
+
return False
|
|
131
151
|
|
|
132
152
|
def play_with_android_mxplayer(self, extract_data: ExtractResult):
|
|
133
153
|
konsol.log(f"[yellow][»] MxPlayer ile Oynatılıyor : {extract_data.url}")
|
|
134
|
-
konsol.print(self.headers)
|
|
154
|
+
# konsol.print(self.headers)
|
|
135
155
|
paketler = [
|
|
136
156
|
"com.mxtech.videoplayer.ad/.ActivityScreen", # Free sürüm
|
|
137
157
|
"com.mxtech.videoplayer.pro/.ActivityScreen" # Pro sürüm
|
|
@@ -152,11 +172,12 @@ class MediaHandler:
|
|
|
152
172
|
with open(os.devnull, "w") as devnull:
|
|
153
173
|
subprocess.run(android_command, stdout=devnull, stderr=devnull, check=True)
|
|
154
174
|
|
|
155
|
-
return
|
|
156
|
-
|
|
175
|
+
return True
|
|
157
176
|
except subprocess.CalledProcessError as hata:
|
|
158
177
|
konsol.print(f"[red]{paket} oynatma hatası: {hata}[/red]")
|
|
159
178
|
konsol.print({"title": self.title, "url": extract_data.url, "headers": self.headers})
|
|
179
|
+
return False
|
|
160
180
|
except FileNotFoundError:
|
|
161
181
|
konsol.print(f"Paket: {paket}, Hata: MX Player kurulu değil")
|
|
162
|
-
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
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
|
|
2
2
|
|
|
3
|
-
from abc
|
|
4
|
-
from
|
|
5
|
-
from
|
|
6
|
-
from .PluginModels
|
|
7
|
-
from ..Media.MediaHandler
|
|
8
|
-
from
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from cloudscraper import CloudScraper
|
|
5
|
+
from httpx import AsyncClient
|
|
6
|
+
from .PluginModels import MainPageResult, SearchResult, MovieInfo
|
|
7
|
+
from ..Media.MediaHandler import MediaHandler
|
|
8
|
+
from ..Extractor.ExtractorManager import ExtractorManager
|
|
9
|
+
from urllib.parse import urljoin
|
|
9
10
|
import re
|
|
10
11
|
|
|
11
12
|
class PluginBase(ABC):
|
|
@@ -17,30 +18,34 @@ class PluginBase(ABC):
|
|
|
17
18
|
|
|
18
19
|
main_page = {}
|
|
19
20
|
|
|
20
|
-
_data = {}
|
|
21
|
-
|
|
22
21
|
async def url_update(self, new_url: str):
|
|
23
22
|
self.favicon = self.favicon.replace(self.main_url, new_url)
|
|
24
23
|
self.main_page = {url.replace(self.main_url, new_url): category for url, category in self.main_page.items()}
|
|
25
24
|
self.main_url = new_url
|
|
26
25
|
|
|
27
26
|
def __init__(self):
|
|
27
|
+
# cloudscraper - for bypassing Cloudflare
|
|
28
|
+
self.cloudscraper = CloudScraper()
|
|
29
|
+
|
|
30
|
+
# httpx - lightweight and safe for most HTTP requests
|
|
28
31
|
self.httpx = AsyncClient(
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
|
|
32
|
-
},
|
|
33
|
-
timeout = Timeout(10.0),
|
|
32
|
+
timeout = 3,
|
|
33
|
+
follow_redirects = True
|
|
34
34
|
)
|
|
35
|
-
self.media_handler = MediaHandler()
|
|
36
|
-
self.cloudscraper = CloudScraper()
|
|
37
35
|
self.httpx.headers.update(self.cloudscraper.headers)
|
|
38
36
|
self.httpx.cookies.update(self.cloudscraper.cookies)
|
|
37
|
+
self.httpx.headers.update({
|
|
38
|
+
"User-Agent" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 15.7; rv:135.0) Gecko/20100101 Firefox/135.0",
|
|
39
|
+
"Accept" : "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"
|
|
40
|
+
})
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
self.media_handler = MediaHandler()
|
|
43
|
+
self.ex_manager = ExtractorManager()
|
|
44
|
+
|
|
45
|
+
@abstractmethod
|
|
46
|
+
async def get_main_page(self, page: int, url: str, category: str) -> list[MainPageResult]:
|
|
47
|
+
"""Ana sayfadaki popüler içerikleri döndürür."""
|
|
48
|
+
pass
|
|
44
49
|
|
|
45
50
|
@abstractmethod
|
|
46
51
|
async def search(self, query: str) -> list[SearchResult]:
|
|
@@ -53,11 +58,32 @@ class PluginBase(ABC):
|
|
|
53
58
|
pass
|
|
54
59
|
|
|
55
60
|
@abstractmethod
|
|
56
|
-
async def load_links(self, url: str) -> list[
|
|
57
|
-
"""
|
|
61
|
+
async def load_links(self, url: str) -> list[dict]:
|
|
62
|
+
"""
|
|
63
|
+
Bir medya öğesi için oynatma bağlantılarını döndürür.
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
url: Medya URL'si
|
|
67
|
+
|
|
68
|
+
Returns:
|
|
69
|
+
Dictionary listesi, her biri şu alanları içerir:
|
|
70
|
+
- url (str, zorunlu): Video URL'si
|
|
71
|
+
- name (str, zorunlu): Gösterim adı (tüm bilgileri içerir)
|
|
72
|
+
- referer (str, opsiyonel): Referer header
|
|
73
|
+
- subtitles (list, opsiyonel): Altyazı listesi
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
"url": "https://example.com/video.m3u8",
|
|
79
|
+
"name": "HDFilmCehennemi | 1080p TR Dublaj"
|
|
80
|
+
}
|
|
81
|
+
]
|
|
82
|
+
"""
|
|
58
83
|
pass
|
|
59
84
|
|
|
60
85
|
async def close(self):
|
|
86
|
+
"""Close HTTP client."""
|
|
61
87
|
await self.httpx.aclose()
|
|
62
88
|
|
|
63
89
|
def fix_url(self, url: str) -> str:
|
|
@@ -19,15 +19,19 @@ class PluginLoader:
|
|
|
19
19
|
def load_all(self) -> dict[str, PluginBase]:
|
|
20
20
|
plugins = {}
|
|
21
21
|
|
|
22
|
-
#
|
|
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
|
-
|
|
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]")
|