11# Bu araç @keyiflerolsun tarafından | @KekikAkademi için yazılmıştır.
22
33from KekikStream .Core import PluginBase , MainPageResult , SearchResult , MovieInfo , ExtractResult , HTMLHelper
4+ import asyncio
45
56class SuperFilmIzle (PluginBase ):
67 name = "SuperFilmIzle"
@@ -91,7 +92,7 @@ async def load_item(self, url: str) -> MovieInfo:
9192 tags = secici .select_texts ("ul.post-categories li a" )
9293 rating = secici .select_text ("div.imdb-count" )
9394 rating = rating .replace ("IMDB Puanı" , "" ) if rating else None
94- actors = secici .select_texts ("div.actors a" )
95+ actors = secici .select_texts ("div.actors a" ) or secici . select_texts ( "div.cast a" )
9596
9697 return MovieInfo (
9798 url = url ,
@@ -105,15 +106,73 @@ async def load_item(self, url: str) -> MovieInfo:
105106 )
106107
107108 async def load_links (self , url : str ) -> list [ExtractResult ]:
108- istek = await self .httpx .get (url )
109- secici = HTMLHelper (istek .text )
110-
111- iframe = secici .select_attr ("div.video-content iframe" , "src" )
112- iframe = self .fix_url (iframe ) if iframe else None
113-
114- if not iframe :
115- return []
116-
117- results = []
118-
119- return results
109+ istek = await self .httpx .get (url )
110+ main_text = istek .text
111+ secici = HTMLHelper (main_text )
112+
113+ # 1. Alternatifleri / Parçaları Belirle
114+ # (url, name, needs_fetch)
115+ sources = []
116+
117+ # Keremiya / Movifox Alternatif Yapısı (li.part)
118+ part_items = secici .select ("div#action-parts li.part" )
119+ if part_items :
120+ for li in part_items :
121+ name = secici .select_text ("div.part-name" , li ) or "Alternatif"
122+
123+ # Aktif olan parça (Mevcut sayfada)
124+ if "active" in li .attrs .get ("class" , []):
125+ sources .append ((None , name , False ))
126+
127+ # Pasif olanlar (Link verilmişse)
128+ elif a_tag := secici .select_first ("a.post-page-numbers" , li ):
129+ href = a_tag .attrs .get ("href" )
130+ if href :
131+ sources .append ((self .fix_url (href ), name , True ))
132+ else :
133+ # Alternatif menüsü yoksa tek parça olarak işle
134+ sources .append ((None , "" , False ))
135+
136+ # 2. İşleme Görevlerini Hazırla
137+ extract_tasks = []
138+
139+ async def process_task (source_data ):
140+ src_url , src_name , needs_fetch = source_data
141+
142+ # Iframe'i bulacağımız HTML kaynağını belirle
143+ html_to_parse = main_text
144+ if needs_fetch :
145+ try :
146+ resp = await self .httpx .get (src_url )
147+ html_to_parse = resp .text
148+ except :
149+ return []
150+
151+ # HTML içindeki iframeleri topla
152+ temp_secici = HTMLHelper (html_to_parse )
153+ iframes = []
154+ for ifr in temp_secici .select ("div.video-content iframe" ):
155+ if src := ifr .attrs .get ("src" ) or ifr .attrs .get ("data-src" ):
156+ iframes .append (self .fix_url (src ))
157+
158+ # Bulunan iframeleri extract et (prefix olarak parça adını ekle)
159+ results = []
160+ for ifr_url in iframes :
161+ if extracted := await self .extract (ifr_url , prefix = src_name or None ):
162+ if isinstance (extracted , list ):
163+ results .extend (extracted )
164+ else :
165+ results .append (extracted )
166+ return results
167+
168+ for src in sources :
169+ extract_tasks .append (process_task (src ))
170+
171+ # 3. Tüm Görevleri Paralel Çalıştır ve Sonuçları Topla
172+ results_groups = await asyncio .gather (* extract_tasks )
173+
174+ final_results = []
175+ for group in results_groups :
176+ final_results .extend (group )
177+
178+ return final_results
0 commit comments