Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -17,9 +17,9 @@ def get_movie_embed(imdb_id, ds_lang=None, sub_url=None):
|
|
| 17 |
# Function to get TV show embed URL
|
| 18 |
def get_tv_embed(imdb_id, season=None, episode=None, ds_lang=None, sub_url=None):
|
| 19 |
base_url = "https://vidsrc.xyz/embed/tv"
|
|
|
|
| 20 |
if season and episode:
|
| 21 |
return f"{base_url}/{imdb_id}/{season}-{episode}"
|
| 22 |
-
params = f"?imdb={imdb_id}"
|
| 23 |
if ds_lang:
|
| 24 |
params += f"&ds_lang={ds_lang}"
|
| 25 |
if sub_url:
|
|
@@ -27,8 +27,8 @@ def get_tv_embed(imdb_id, season=None, episode=None, ds_lang=None, sub_url=None)
|
|
| 27 |
return f"{base_url}{params}"
|
| 28 |
|
| 29 |
# Streamlit app layout
|
| 30 |
-
st.title("
|
| 31 |
-
st.write("Search for a movie or TV show
|
| 32 |
|
| 33 |
# Input for search type
|
| 34 |
search_type = st.radio("Select type", ("Movie", "TV Show"))
|
|
@@ -37,8 +37,8 @@ search_type = st.radio("Select type", ("Movie", "TV Show"))
|
|
| 37 |
query = st.text_input("Search IMDb", "Enter the name of a movie or TV show")
|
| 38 |
|
| 39 |
# Optional inputs for additional parameters
|
| 40 |
-
ds_lang = st.text_input("Default subtitle language (
|
| 41 |
-
sub_url = st.text_input("Subtitle URL (
|
| 42 |
|
| 43 |
# Search and display results
|
| 44 |
if st.button("Search"):
|
|
@@ -48,27 +48,24 @@ if st.button("Search"):
|
|
| 48 |
|
| 49 |
# Display search results
|
| 50 |
if results:
|
| 51 |
-
st.write(f"Found {len(results)} results.")
|
| 52 |
-
for idx, result in enumerate(results):
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
|
| 66 |
-
|
| 67 |
-
embed_url
|
| 68 |
-
|
| 69 |
-
# Display the embed URL
|
| 70 |
-
st.write("Embed URL:")
|
| 71 |
-
st.write(embed_url)
|
| 72 |
else:
|
| 73 |
st.write("No results found.")
|
| 74 |
else:
|
|
|
|
| 17 |
# Function to get TV show embed URL
|
| 18 |
def get_tv_embed(imdb_id, season=None, episode=None, ds_lang=None, sub_url=None):
|
| 19 |
base_url = "https://vidsrc.xyz/embed/tv"
|
| 20 |
+
params = f"?imdb={imdb_id}"
|
| 21 |
if season and episode:
|
| 22 |
return f"{base_url}/{imdb_id}/{season}-{episode}"
|
|
|
|
| 23 |
if ds_lang:
|
| 24 |
params += f"&ds_lang={ds_lang}"
|
| 25 |
if sub_url:
|
|
|
|
| 27 |
return f"{base_url}{params}"
|
| 28 |
|
| 29 |
# Streamlit app layout
|
| 30 |
+
st.title("WATCH ONLINE MOVIES FOR FREE")
|
| 31 |
+
st.write("Search for a movie or TV show")
|
| 32 |
|
| 33 |
# Input for search type
|
| 34 |
search_type = st.radio("Select type", ("Movie", "TV Show"))
|
|
|
|
| 37 |
query = st.text_input("Search IMDb", "Enter the name of a movie or TV show")
|
| 38 |
|
| 39 |
# Optional inputs for additional parameters
|
| 40 |
+
ds_lang = st.text_input("Default subtitle language (Leave it empty if you do not want to use it)", "")
|
| 41 |
+
sub_url = st.text_input("Subtitle URL (Leave it empty if you do not want to use it)", "")
|
| 42 |
|
| 43 |
# Search and display results
|
| 44 |
if st.button("Search"):
|
|
|
|
| 48 |
|
| 49 |
# Display search results
|
| 50 |
if results:
|
| 51 |
+
st.write(f"Found {len(results)} results. Displaying up to 20 results:")
|
| 52 |
+
for idx, result in enumerate(results[:20]): # Limit to 20 results
|
| 53 |
+
title = result.get('title', 'Unknown title')
|
| 54 |
+
year = result.get('year', 'N/A')
|
| 55 |
+
imdb_id = result.movieID
|
| 56 |
+
|
| 57 |
+
st.write(f"{idx + 1}. {title} ({year})")
|
| 58 |
+
|
| 59 |
+
# Generate embed URL based on search type
|
| 60 |
+
if search_type == "Movie":
|
| 61 |
+
embed_url = get_movie_embed(imdb_id, ds_lang, sub_url)
|
| 62 |
+
else:
|
| 63 |
+
embed_url = get_tv_embed(imdb_id, ds_lang=ds_lang, sub_url=sub_url)
|
| 64 |
+
|
| 65 |
+
# Display the embed URL
|
| 66 |
+
st.write("Embed URL:")
|
| 67 |
+
st.write(embed_url)
|
| 68 |
+
st.write("---")
|
|
|
|
|
|
|
|
|
|
| 69 |
else:
|
| 70 |
st.write("No results found.")
|
| 71 |
else:
|