KekikStream 2.0.6__py3-none-any.whl → 2.0.7__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.
@@ -10,6 +10,86 @@ class YTDLP(ExtractorBase):
10
10
 
11
11
  _FAST_DOMAIN_RE = None # compiled mega-regex (host üstünden)
12
12
 
13
+ _POPULAR_TLDS = {
14
+ "com", "net", "org", "tv", "io", "co", "me", "ly", "ru", "fr", "de", "es", "it",
15
+ "nl", "be", "ch", "at", "uk", "ca", "au", "jp", "kr", "cn", "in", "br", "mx",
16
+ "ar", "tr", "gov", "edu", "mil", "int", "info", "biz", "name", "pro", "aero",
17
+ "coop", "museum", "onion"
18
+ }
19
+
20
+ # 1. Literal TLD Regex: youtube\.com, vimeo\.com
21
+ # sorted by reverse length to prevent partial matches (e.g. 'co' matching 'com')
22
+ _LITERAL_TLD_RE = re.compile(
23
+ rf"([a-z0-9][-a-z0-9]*(?:\\\.[-a-z0-9]+)*\\\.(?:{'|'.join(sorted(_POPULAR_TLDS, key=len, reverse=True))}))",
24
+ re.IGNORECASE
25
+ )
26
+
27
+ # 2. Regex TLD Regex: dailymotion\.[a-z]{2,3}
28
+ _REGEX_TLD_RE = re.compile(
29
+ r"([a-z0-9][-a-z0-9]*)\\\.\[a-z\]\{?\d*,?\d*\}?",
30
+ re.IGNORECASE
31
+ )
32
+
33
+ # 3. Alternation TLD Regex: \.(?:com|net|org)
34
+ _ALT_TLD_RE = re.compile(
35
+ r"\\\.\(\?:([a-z|]+)\)",
36
+ re.IGNORECASE
37
+ )
38
+
39
+ # Kelime yakalayıcı (domain bulmak için)
40
+ _DOMAIN_WORD_RE = re.compile(
41
+ r"([a-z0-9][-a-z0-9]*)",
42
+ re.IGNORECASE
43
+ )
44
+
45
+ @classmethod
46
+ def _extract_literal_domains(cls, valid_url: str) -> set[str]:
47
+ """Pattern 1: Literal TLD domainlerini (youtube.com) çıkarır."""
48
+ return {
49
+ m.replace(r"\.", ".").lower()
50
+ for m in cls._LITERAL_TLD_RE.findall(valid_url)
51
+ }
52
+
53
+ @classmethod
54
+ def _extract_regex_tld_domains(cls, valid_url: str) -> set[str]:
55
+ """Pattern 2: Regex TLD domainlerini (dailymotion.[...]) çıkarır ve popüler TLD'lerle birleştirir."""
56
+ domains = set()
57
+ for base in cls._REGEX_TLD_RE.findall(valid_url):
58
+ base_domain = base.lower()
59
+ for tld in cls._POPULAR_TLDS:
60
+ domains.add(f"{base_domain}.{tld}")
61
+ return domains
62
+
63
+ @classmethod
64
+ def _extract_alternation_domains(cls, valid_url: str) -> set[str]:
65
+ """Pattern 3: Alternation TLD domainlerini (pornhub.(?:com|net)) çıkarır."""
66
+ domains = set()
67
+ for m in cls._ALT_TLD_RE.finditer(valid_url):
68
+ tlds = m.group(1).split("|")
69
+ start = m.start()
70
+
71
+ # Geriye doğru git ve domain'i bul
72
+ before = valid_url[:start]
73
+
74
+ # 1. Named Groups (?P<name> temizle
75
+ before = re.sub(r"\(\?P<[^>]+>", "", before)
76
+
77
+ # 2. Simple Non-Capturing Groups (?:xxx)? temizle (sadece alphanumeric ve escape)
78
+ before = re.sub(r"\(\?:[a-z0-9-]+\)\??", "", before)
79
+
80
+ # Son domain-like kelimeyi al
81
+ words = cls._DOMAIN_WORD_RE.findall(before)
82
+ if not words:
83
+ continue
84
+
85
+ base = words[-1].lower()
86
+ for tld in tlds:
87
+ tld = tld.strip().lower()
88
+ if tld and len(tld) <= 6:
89
+ domains.add(f"{base}.{tld}")
90
+
91
+ return domains
92
+
13
93
  @classmethod
14
94
  def _init_fast_domain_regex(cls):
15
95
  """
@@ -19,44 +99,31 @@ class YTDLP(ExtractorBase):
19
99
  return
20
100
 
21
101
  domains = set()
22
-
23
- # Merkezi cache'den extractorları al
24
102
  extractors = get_ytdlp_extractors()
25
103
 
26
- # yt-dlp extractor'larının _VALID_URL regex'lerinden domain yakala
27
- # Regex metinlerinde domainler genelde "\." şeklinde geçer.
28
- domain_pat = re.compile(r"(?:[a-z0-9-]+\\\.)+[a-z]{2,}", re.IGNORECASE)
29
-
30
104
  for ie in extractors:
31
105
  valid = getattr(ie, "_VALID_URL", None)
32
106
  if not valid or not isinstance(valid, str):
33
107
  continue
34
108
 
35
- for m in domain_pat.findall(valid):
36
- d = m.replace(r"\.", ".").lower()
37
-
38
- # Çok agresif/şüpheli şeyleri elemek istersen burada filtre koyabilirsin
39
- # (genelde gerek kalmıyor)
40
- domains.add(d)
109
+ domains |= cls._extract_literal_domains(valid)
110
+ domains |= cls._extract_regex_tld_domains(valid)
111
+ domains |= cls._extract_alternation_domains(valid)
41
112
 
42
113
  # Hiç domain çıkmazsa (çok uç durum) fallback: boş regex
43
114
  if not domains:
44
115
  cls._FAST_DOMAIN_RE = re.compile(r"$^") # hiçbir şeye match etmez
45
116
  return
46
117
 
47
- # Host eşleştirmesi: subdomain destekli (m.youtube.com, player.vimeo.com vs.)
48
- # (?:^|.*\.) (domain1|domain2|...) $
49
- joined = "|".join(sorted(re.escape(d) for d in domains))
50
- pattern = rf"(?:^|.*\.)(?:{joined})$"
51
- cls._FAST_DOMAIN_RE = re.compile(pattern, re.IGNORECASE)
118
+ joined = "|".join(re.escape(d) for d in sorted(domains))
119
+ cls._FAST_DOMAIN_RE = re.compile(rf"(?:^|.*\.)(?:{joined})$", re.IGNORECASE)
52
120
 
53
121
  def __init__(self):
54
122
  self.__class__._init_fast_domain_regex()
55
123
 
56
124
  def can_handle_url(self, url: str) -> bool:
57
125
  """
58
- Fast-path: URL host'unu tek mega-regex ile kontrol et (loop yok)
59
- Slow-path: gerekirse mevcut extract_info tabanlı kontrolün
126
+ Fast-path: URL host'unu tek mega-regex ile kontrol et
60
127
  """
61
128
  # URL parse + host al
62
129
  try:
@@ -77,40 +144,7 @@ class YTDLP(ExtractorBase):
77
144
  if host and self.__class__._FAST_DOMAIN_RE.search(host):
78
145
  return True
79
146
 
80
- # SLOW PATH: Diğer siteler için yt-dlp'nin native kontrolü
81
- # try:
82
- # # stderr'ı geçici olarak kapat (hata mesajlarını gizle)
83
- # old_stderr = sys.stderr
84
- # sys.stderr = open(os.devnull, "w")
85
-
86
- # try:
87
- # ydl_opts = {
88
- # "simulate" : True, # Download yok, sadece tespit
89
- # "quiet" : True, # Log kirliliği yok
90
- # "no_warnings" : True, # Uyarı mesajları yok
91
- # "extract_flat" : True, # Minimal işlem
92
- # "no_check_certificates" : True,
93
- # "ignoreerrors" : True, # Hataları yoksay
94
- # "socket_timeout" : 3,
95
- # "retries" : 1
96
- # }
97
-
98
- # with yt_dlp.YoutubeDL(ydl_opts) as ydl:
99
- # # URL'yi işleyebiliyor mu kontrol et
100
- # info = ydl.extract_info(url, download=False, process=False)
101
-
102
- # # Generic extractor ise atla
103
- # if info and info.get("extractor_key") != "Generic":
104
- # return True
105
-
106
- # return False
107
- # finally:
108
- # # stderr'ı geri yükle
109
- # sys.stderr.close()
110
- # sys.stderr = old_stderr
111
-
112
- # except Exception:
113
- # yt-dlp işleyemezse False döndür
147
+ # yt-dlp işleyemezse False döndür
114
148
  return False
115
149
 
116
150
  async def extract(self, url: str, referer: str | None = None) -> ExtractResult:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: KekikStream
3
- Version: 2.0.6
3
+ Version: 2.0.7
4
4
  Summary: terminal üzerinden medya içeriği aramanızı ve VLC/MPV gibi popüler medya oynatıcılar aracılığıyla doğrudan izlemenizi sağlayan modüler ve genişletilebilir bir bıdı bıdı
5
5
  Home-page: https://github.com/keyiflerolsun/KekikStream
6
6
  Author: keyiflerolsun
@@ -47,7 +47,7 @@ KekikStream/Extractors/VidMoly.py,sha256=zuo3LqaDJ0Qs6H6l9z5TjosTSpsQ37KEBXQpGVO
47
47
  KekikStream/Extractors/VidMoxy.py,sha256=LT7wTKBtuuagXwfGjWZwQF2NQGuChurZJ-I6gM0Jcek,1771
48
48
  KekikStream/Extractors/VidPapi.py,sha256=g9ohdL9VJrxy4N7xerbIRz3ZxjsXFHlJWy0NaZ31hFY,3259
49
49
  KekikStream/Extractors/VideoSeyred.py,sha256=M6QPZ_isX9vM_7LPo-2I_8Cf1vB9awHw8vvzBODtoiQ,1977
50
- KekikStream/Extractors/YTDLP.py,sha256=KKvvv6XiKM57NON2Vpw24O31xUKpgcovHTPYh05QHW8,6543
50
+ KekikStream/Extractors/YTDLP.py,sha256=Hy8loCSFSquu2zaL3INord-Jm6T8CM6K2-VcDA2K79g,7390
51
51
  KekikStream/Extractors/YildizKisaFilm.py,sha256=R_JlrOVeMiDlXYcuTdItnKvidyx8_u3B14fSrxew2aE,1316
52
52
  KekikStream/Plugins/BelgeselX.py,sha256=WdCeU_Zvsph0kHt7jAWaZ3DQ_2rxaFChmhGKPcHLJpo,8728
53
53
  KekikStream/Plugins/DiziBox.py,sha256=sxM7ckKeKwMrMkRNUAvh5wE9wdOuVda6Ag_zAdwSvi8,9935
@@ -73,9 +73,9 @@ KekikStream/Plugins/SinemaCX.py,sha256=dIJUOOtWSyMx7vGOE1NjrsCeW1n5DHh40--KSiW0k
73
73
  KekikStream/Plugins/Sinezy.py,sha256=gdszlee5QpUka0qMzGMbBoXwJCtZbe5hlA5o9FJQI1o,6226
74
74
  KekikStream/Plugins/SuperFilmGeldi.py,sha256=4kgdWpYCLBSAn2XfL1usFG33LsTtDvo28fmDecwNA_U,5480
75
75
  KekikStream/Plugins/UgurFilm.py,sha256=sQatQ2zb9NER8J52DRLI5K9EnYFv4I1ZgZ22HtauX3Q,4813
76
- kekikstream-2.0.6.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
77
- kekikstream-2.0.6.dist-info/METADATA,sha256=XoEsfLftrCVygDEH8q31lqedRDJA9rfJdc9KvahKK8k,10090
78
- kekikstream-2.0.6.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
- kekikstream-2.0.6.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
80
- kekikstream-2.0.6.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
81
- kekikstream-2.0.6.dist-info/RECORD,,
76
+ kekikstream-2.0.7.dist-info/licenses/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
77
+ kekikstream-2.0.7.dist-info/METADATA,sha256=xuc3sfApA6A_sT8w-BECu-zUC6kG-qTmF2SN4hOp73I,10090
78
+ kekikstream-2.0.7.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
79
+ kekikstream-2.0.7.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
80
+ kekikstream-2.0.7.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
81
+ kekikstream-2.0.7.dist-info/RECORD,,