KekikStream 0.2.4__py3-none-any.whl → 0.2.5__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.
@@ -0,0 +1,94 @@
1
+ # Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
2
+
3
+ from KekikStream.Core import ExtractorBase, ExtractResult
4
+ import re
5
+ import json
6
+
7
+ class Odnoklassniki(ExtractorBase):
8
+ name = "Odnoklassniki"
9
+ main_url = "https://odnoklassniki.ru"
10
+
11
+ async def extract(self, url, referer=None) -> ExtractResult:
12
+ if referer:
13
+ self.oturum.headers.update({"Referer": referer})
14
+
15
+ self.oturum.headers.update({
16
+ "User-Agent": "Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Mobile Safari/537.36"
17
+ })
18
+
19
+ try:
20
+ # İlk isteği yap, ancak yönlendirmeyi manuel olarak kontrol et.
21
+ istek = await self.oturum.get(url, follow_redirects=False)
22
+ if istek.status_code == 302: # Yönlendirme varsa
23
+ redirected_url = istek.headers.get("Location")
24
+ if not redirected_url:
25
+ raise ValueError("Redirect location not found.")
26
+
27
+ # Yönlendirilmiş URL'yi kullanarak isteği yeniden yap.
28
+ url = redirected_url if redirected_url.startswith("http") else f"https://{redirected_url}"
29
+ istek = await self.oturum.get(url)
30
+
31
+ istek.raise_for_status()
32
+ except Exception as e:
33
+ raise RuntimeError(f"Failed to fetch the URL: {url}, Error: {e}")
34
+
35
+ response_text = (
36
+ istek.text.replace("\\"", "\"")
37
+ .replace("\\\\", "\\")
38
+ .replace(r"\\u", "\\u")
39
+ )
40
+ response_text = re.sub(
41
+ r"\\u([0-9A-Fa-f]{4})",
42
+ lambda match: chr(int(match.group(1), 16)),
43
+ response_text
44
+ )
45
+
46
+ videos_match = re.search(r'"videos":(\[.*?\])', response_text)
47
+ if not videos_match:
48
+ raise ValueError("No video data found in the response.")
49
+
50
+ videos_str = videos_match.group(1)
51
+ try:
52
+ videos = json.loads(videos_str)
53
+ except json.JSONDecodeError:
54
+ raise ValueError("Failed to parse video data.")
55
+
56
+ quality_order = {
57
+ "ULTRA": 6, # 4K veya daha yüksek
58
+ "QUAD": 5, # 1440p
59
+ "FULL": 4, # 1080p
60
+ "HD": 3, # 720p
61
+ "SD": 2, # 480p
62
+ "LOW": 1, # 360p
63
+ "MOBILE": 0 # 144p
64
+ }
65
+
66
+ # Kaliteye göre en iyi videoyu seçme
67
+ best_video = None
68
+ best_quality_score = -1
69
+
70
+ for video in videos:
71
+ video_url = video.get("url")
72
+ quality_name = video.get("name", "").upper()
73
+
74
+ if not video_url or not quality_name:
75
+ continue
76
+
77
+ # Kalite sıralamasına göre puanla
78
+ quality_score = quality_order.get(quality_name, -1)
79
+ if quality_score > best_quality_score:
80
+ best_quality_score = quality_score
81
+ best_video = video_url
82
+
83
+ if not best_video:
84
+ raise ValueError("No valid video URLs found.")
85
+
86
+ if best_video.startswith("//"):
87
+ best_video = f"https:{best_video}"
88
+
89
+ return ExtractResult(
90
+ name = self.name,
91
+ url = best_video,
92
+ referer = self.main_url,
93
+ subtitles = []
94
+ )
@@ -14,24 +14,23 @@ class VidMoly(ExtractorBase):
14
14
  if referer:
15
15
  self.oturum.headers.update({"Referer": referer})
16
16
 
17
- headers = {
18
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
19
- "Sec-Fetch-Dest": "iframe",
20
- }
17
+ self.oturum.headers.update({
18
+ "User-Agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36",
19
+ "Sec-Fetch-Dest" : "iframe",
20
+ })
21
21
 
22
22
  # Embed URL oluştur
23
- embed_url = (
24
- url.replace("/w/", "/embed-") + "-920x360.html" if "/w/" in url else url
25
- )
23
+ embed_url = url.replace("/w/", "/embed-") + "-920x360.html" if "/w/" in url else url
26
24
  script_content = None
27
- attempts = 0
25
+ attempts = 0
28
26
 
29
27
  # Script verisini almak için deneme yap
30
28
  while attempts < 10 and not script_content:
31
29
  attempts += 1
32
- response = await self.oturum.get(embed_url, headers=headers)
30
+ response = await self.oturum.get(embed_url)
33
31
  response.raise_for_status()
34
- script_match = re.search(r"sources:\s*\[(.*?)\],", response.text, re.DOTALL)
32
+
33
+ script_match = re.search(r"sources:\s*\[(.*?)\],", response.text, re.DOTALL)
35
34
  script_content = script_match.group(1) if script_match else None
36
35
  if not script_content:
37
36
  await asyncio.sleep(0.5)
@@ -58,11 +57,11 @@ class VidMoly(ExtractorBase):
58
57
  subtitle_sources = json.loads(f"[{subtitle_data}]")
59
58
  subtitles = [
60
59
  Subtitle(
61
- name=sub.get("label"),
62
- url=self.fix_url(sub.get("file")),
60
+ name = sub.get("label"),
61
+ url = self.fix_url(sub.get("file")),
63
62
  )
64
- for sub in subtitle_sources
65
- if sub.get("kind") == "captions"
63
+ for sub in subtitle_sources
64
+ if sub.get("kind") == "captions"
66
65
  ]
67
66
  except json.JSONDecodeError:
68
67
  pass
@@ -80,10 +79,10 @@ class VidMoly(ExtractorBase):
80
79
 
81
80
  await self.close()
82
81
  return ExtractResult(
83
- name=self.name,
84
- url=video_url,
85
- referer=self.main_url,
86
- subtitles=subtitles,
82
+ name = self.name,
83
+ url = video_url,
84
+ referer = self.main_url,
85
+ subtitles = subtitles
87
86
  )
88
87
 
89
88
  def _add_marks(self, text: str, field: str) -> str:
@@ -50,6 +50,9 @@ class SineWix(PluginBase):
50
50
  episodes = []
51
51
  for season in veri.get("seasons"):
52
52
  for episode in season.get("episodes"):
53
+ if not episode.get("videos"):
54
+ continue
55
+
53
56
  ep_model = Episode(
54
57
  season = season.get("season_number"),
55
58
  episode = episode.get("episode_number"),
KekikStream/__init__.py CHANGED
@@ -25,6 +25,20 @@ class KekikStream:
25
25
  finally:
26
26
  await self.plugin_manager.close_plugins()
27
27
 
28
+ async def handle_no_results(self):
29
+ action = await self.ui_manager.select_from_list(
30
+ message = "Ne yapmak istersiniz?",
31
+ choices = ["Geri Git", "Ana Menü", "Çıkış"]
32
+ )
33
+
34
+ match action:
35
+ case "Geri Git":
36
+ await self.search_all()
37
+ case "Ana Menü":
38
+ await self.run()
39
+ case "Çıkış":
40
+ cikis_yap(False)
41
+
28
42
  async def select_plugin(self):
29
43
  plugin_name = await self.ui_manager.select_from_fuzzy(
30
44
  message = "Arama yapılacak eklentiyi seçin:",
@@ -113,6 +127,10 @@ class KekikStream:
113
127
  await self.show_options(links)
114
128
 
115
129
  async def show_options(self, links):
130
+ if not links:
131
+ konsol.print("[bold red]Hiçbir bağlantı bulunamadı![/bold red]")
132
+ return await self.handle_no_results()
133
+
116
134
  mapping = self.extractor_manager.map_links_to_extractors(links)
117
135
  has_play_method = hasattr(self.current_plugin, "play") and callable(getattr(self.current_plugin, "play", None))
118
136
  # ! DEBUG
@@ -120,7 +138,7 @@ class KekikStream:
120
138
  if not mapping and not has_play_method:
121
139
  konsol.print("[bold red]Hiçbir Extractor bulunamadı![/bold red]")
122
140
  konsol.print(links)
123
- return
141
+ return await self.handle_no_results()
124
142
 
125
143
  if not mapping:
126
144
  selected_link = await self.ui_manager.select_from_list(
@@ -146,7 +164,7 @@ class KekikStream:
146
164
  await self.play_media(selected_link)
147
165
 
148
166
  case "Geri Git":
149
- await self.search()
167
+ await self.search_all()
150
168
 
151
169
  case _:
152
170
  await self.run()
@@ -203,6 +221,7 @@ class KekikStream:
203
221
 
204
222
  if not all_results:
205
223
  konsol.print("[bold red]Hiçbir sonuç bulunamadı![/bold red]")
224
+ await self.handle_no_results()
206
225
  return []
207
226
 
208
227
  return all_results
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: KekikStream
3
- Version: 0.2.4
3
+ Version: 0.2.5
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
@@ -1,4 +1,4 @@
1
- KekikStream/__init__.py,sha256=51EpuqJ5H7CU9aA-K2V1DN2iOF9eRp_y776mhv1E8ls,9328
1
+ KekikStream/__init__.py,sha256=9oTVlq0MbL5E5w_mSPjuC3Fi4dYn_Mgzww3fld3zjiQ,9993
2
2
  KekikStream/__main__.py,sha256=4U-NO1f0Mts5Mf_QnWhWqRbTsRBy2y2VPlpHyaqG9_I,137
3
3
  KekikStream/requirements.txt,sha256=Kh3E0NzIkAmhVODtIwRVffVOHLiElO6Ua9kIgjbocPE,57
4
4
  KekikStream/CLI/__init__.py,sha256=9YlF135BVff85y492hX4sq2WY2CNqa4BuVzF9hIIaKE,233
@@ -13,6 +13,7 @@ KekikStream/Core/PluginModels.py,sha256=WWPEz8PpZZ4bLMDJzTE19BsQEJObkyhaYjDkyLaF
13
13
  KekikStream/Core/__init__.py,sha256=HZpXs3MKy4joO0sDpIGcZ2DrUKwK49IKG-GQgKbO2jk,416
14
14
  KekikStream/Extractors/CloseLoad.py,sha256=YmDB3YvuDaCUbQ0T_tmhnkEsC5mSdEN6GNoAR662fl8,990
15
15
  KekikStream/Extractors/MailRu.py,sha256=lB3Xy912EaSEUw7Im65L5TwtIeM7OLFV1_9lan39g40,1308
16
+ KekikStream/Extractors/Odnoklassniki.py,sha256=rP9jzJ42PGyguoEckpm-9nMtfqyXTN2lVzWgG-WYVaI,3296
16
17
  KekikStream/Extractors/PixelDrain.py,sha256=JLNaTdFJfXj5ExB_OjjyjwBZBD_gCOmL3fO_TWbHe90,998
17
18
  KekikStream/Extractors/RapidVid.py,sha256=HmSXDWhE1EXZRhNCxrqqEBbyJKbqFtTFRtq-zYg3G2c,2430
18
19
  KekikStream/Extractors/SibNet.py,sha256=w0Rv1cYB_Ho6M9Aho9n38Thp6mAfKPNe-eKFC_DbGuE,884
@@ -20,7 +21,7 @@ KekikStream/Extractors/Sobreatsesuyp.py,sha256=7JUbqHLMWFkHuzH3NG2ogaV53e9fUmGvA
20
21
  KekikStream/Extractors/TRsTX.py,sha256=jhPcQq7KPxL0SPvEFL4MG7oDXDpBbt6Qh8vRJ_bLQMU,2105
21
22
  KekikStream/Extractors/TauVideo.py,sha256=bBjrZFSi4QqSJhRB0sDWMA0Saio-zpoAb6Ss4QZmBeY,1045
22
23
  KekikStream/Extractors/TurboImgz.py,sha256=0d9t6bj4prVt1_LIbzwcfuqrSRB7SMvc4RKvE25BtW4,851
23
- KekikStream/Extractors/VidMoly.py,sha256=a2ElfpEcTWBpBT0mADWcEF2T8l9WjAEuX8Dux0hiYrU,3390
24
+ KekikStream/Extractors/VidMoly.py,sha256=uzYArLNLTI8mZpMsOABWUOhJtT3FaY6GBrDnQ3Oyl90,3424
24
25
  KekikStream/Extractors/VidMoxy.py,sha256=UnVrCEI4XNiONE2aLV9dGUhRqQ9ELJTnYVXyG81N11A,1800
25
26
  KekikStream/Managers/ExtractorManager.py,sha256=9rGlUsnedJ7fwIeObN5Vsm8H5VLal0ODO7F93dDRx8w,976
26
27
  KekikStream/Managers/MediaManager.py,sha256=F7mkSvAttAaMHRvnDcxnV2K1D_sK644BCSrEaAmMl_U,522
@@ -31,11 +32,11 @@ KekikStream/Plugins/FilmMakinesi.py,sha256=g4LRDP5Atn97PqbgnEdm0-wjVdXaJIVk1Ru0F
31
32
  KekikStream/Plugins/FullHDFilmizlesene.py,sha256=HJzHDXHhhMpvXxiD2SjpoZEYs7dmnPymE8EXCSvLKVo,3106
32
33
  KekikStream/Plugins/JetFilmizle.py,sha256=DPdvTEns8r2MI9pHY8d9EEsUZmlQU7N2C9yr8ox80qU,4016
33
34
  KekikStream/Plugins/SezonlukDizi.py,sha256=5BZVzQ2eQtymHxO0bzjA2ho4FFNahPFQly4hoHuH8lo,4441
34
- KekikStream/Plugins/SineWix.py,sha256=RJxggTrZxBimQHI4ehtJipVeIBpfHy85NW-ixE2iF2k,4762
35
+ KekikStream/Plugins/SineWix.py,sha256=ZtcIwPW0ONGkSjT7Ye8b71RWdHZMUZefX-JTWu6uGSs,4854
35
36
  KekikStream/Plugins/UgurFilm.py,sha256=U7ryNWpjSZJWuYlMGX1Be9uuyiM3SfuI9VJcEiXedNs,2960
36
- KekikStream-0.2.4.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
37
- KekikStream-0.2.4.dist-info/METADATA,sha256=pSLDjBdGobd9AgKWe-LgcePL6drmPglNSMIwskFS5gI,3959
38
- KekikStream-0.2.4.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
39
- KekikStream-0.2.4.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
40
- KekikStream-0.2.4.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
41
- KekikStream-0.2.4.dist-info/RECORD,,
37
+ KekikStream-0.2.5.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
38
+ KekikStream-0.2.5.dist-info/METADATA,sha256=Fb_lAoiyd9AXVnT6eYWPR26_CbkAwHGCJQpSjD7AOXw,3959
39
+ KekikStream-0.2.5.dist-info/WHEEL,sha256=PZUExdf71Ui_so67QXpySuHtCi3-J3wvF4ORK6k_S8U,91
40
+ KekikStream-0.2.5.dist-info/entry_points.txt,sha256=dFwdiTx8djyehI0Gsz-rZwjAfZzUzoBSrmzRu9ubjJc,50
41
+ KekikStream-0.2.5.dist-info/top_level.txt,sha256=DNmGJDXl27Drdfobrak8KYLmocW_uznVYFJOzcjUgmY,12
42
+ KekikStream-0.2.5.dist-info/RECORD,,