Spaces:
Sleeping
Sleeping
Upload 2 files
Browse files- app.py +62 -0
- requirements.txt +3 -0
app.py
ADDED
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import anipy_cli
|
2 |
+
import streamlit as st
|
3 |
+
import tempfile
|
4 |
+
from pathlib import Path
|
5 |
+
|
6 |
+
def main():
|
7 |
+
st.markdown("<h1 style='text-align: center; color: #ff6961;'>Anius【アイヌス】🎬</h1>", unsafe_allow_html=True)
|
8 |
+
st.write("---")
|
9 |
+
|
10 |
+
# Step 1: Search for an anime
|
11 |
+
query_term = st.text_input("Search for an anime: 🔍", placeholder="Enter an anime name...")
|
12 |
+
|
13 |
+
if query_term:
|
14 |
+
entry = anipy_cli.Entry()
|
15 |
+
query_class = anipy_cli.query(query_term, entry)
|
16 |
+
links_and_names = query_class.get_links()
|
17 |
+
|
18 |
+
# Store search results in backend with serial numbers
|
19 |
+
search_results = []
|
20 |
+
for i, (link, name) in enumerate(zip(links_and_names[0], links_and_names[1]), start=1):
|
21 |
+
search_results.append((f"{i}. {name}", f"https://gogoanime.gg{link}"))
|
22 |
+
|
23 |
+
# Step 2: Select an anime from the search results
|
24 |
+
selected_anime = st.selectbox("Select an anime: 📽️", options=[name for name, _ in search_results])
|
25 |
+
|
26 |
+
if selected_anime:
|
27 |
+
selected_url = next(url for name, url in search_results if name == selected_anime)
|
28 |
+
entry.category_url = selected_url
|
29 |
+
|
30 |
+
# Step 3: Get the episode handler and retrieve the latest episode
|
31 |
+
ep_handler = anipy_cli.epHandler(entry)
|
32 |
+
latest_episode = ep_handler.get_latest()
|
33 |
+
|
34 |
+
# Display the list of available episode numbers
|
35 |
+
available_episodes = list(range(1, latest_episode + 1))
|
36 |
+
|
37 |
+
# Step 4: Get the user's episode selection
|
38 |
+
selected_episode = st.selectbox(f"Select an episode number: 📼 [1-{latest_episode}]", available_episodes)
|
39 |
+
|
40 |
+
if selected_episode:
|
41 |
+
entry.ep = selected_episode
|
42 |
+
entry = ep_handler.gen_eplink()
|
43 |
+
|
44 |
+
# Step 5: Get the video URL
|
45 |
+
video_url_class = anipy_cli.videourl(entry, "best")
|
46 |
+
video_url_class.stream_url()
|
47 |
+
entry = video_url_class.get_entry()
|
48 |
+
#output is: Entry(show_name='', category_url='https://gogoanime.gg/category/naruto-shippuuden-movie-2-kizuna', ep_url='https://gogoanime3.co//naruto-shippuuden-movie-2-kizuna-episode-1', embed_url='https://embtaku.pro/streaming.php?id=NDA1ODg=&title=Naruto+Shippuuden+Movie+2%3A+Kizuna+Episode+1&typesub=SUB', stream_url='https://www049.vipanicdn.net/streamhls/7a5f81683439c04fa17f5250c3c5438f/ep.1.1709241222.m3u8', ep=1, latest_ep=1, quality='hls')
|
49 |
+
|
50 |
+
# Output the embed link
|
51 |
+
st.success(f"Embed Link: 🎥 {entry.embed_url}")
|
52 |
+
|
53 |
+
# Play the video in Streamlit
|
54 |
+
# video_html = f'<video width="100%" height="auto" controls><source src="{entry.stream_url}" type="video/mp4"></video>'
|
55 |
+
# st.markdown(video_html, unsafe_allow_html=True)
|
56 |
+
from streamlit_player import st_player
|
57 |
+
st_player(f"{entry.stream_url}")
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
if __name__ == "__main__":
|
62 |
+
main()
|
requirements.txt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
anipy_cli==2.7.31
|
2 |
+
streamlit==1.28.1
|
3 |
+
streamlit_player==0.1.5
|