Neon-AI commited on
Commit
a5af68f
·
verified ·
1 Parent(s): 668030e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -36
app.py CHANGED
@@ -184,42 +184,6 @@ def get_metadata(path: str):
184
 
185
  except Exception as e:
186
  raise HTTPException(status_code=500, detail=f"Failed to fetch metadata: {str(e)}")
187
-
188
- @app.get("/episodes")
189
- async def get_episodes(path: str):
190
- """
191
- Example:
192
- /episodes?path=/watch/naruto-677
193
- """
194
-
195
- async with async_playwright() as p:
196
- browser = await p.chromium.launch(headless=True)
197
- page = await browser.new_page()
198
-
199
- await page.goto(f"https://hianime.to{path}", timeout=60000)
200
-
201
- # Wait until episode list JS finishes
202
- await page.wait_for_selector("#servers-content", timeout=60000)
203
-
204
- episodes = []
205
-
206
- items = await page.query_selector_all(".ep-item") # selector used after JS loads
207
-
208
- for item in items:
209
- ep_num = await item.get_attribute("data-ep")
210
- ep_id = await item.get_attribute("data-id")
211
-
212
- episodes.append({
213
- "episode": int(ep_num),
214
- "url": f"https://hianime.to{path}?ep={ep_id}"
215
- })
216
-
217
- await browser.close()
218
-
219
- return {
220
- "path": path,
221
- "episodes": episodes
222
- }
223
  # ===== END PATCH =====
224
 
225
  if __name__ == "__main__":
 
184
 
185
  except Exception as e:
186
  raise HTTPException(status_code=500, detail=f"Failed to fetch metadata: {str(e)}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  # ===== END PATCH =====
188
 
189
  if __name__ == "__main__":