Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
import requests
|
| 3 |
+
|
| 4 |
+
# Set page title and background color
|
| 5 |
+
st.title("MTProto KayH GNG Collector")
|
| 6 |
+
st.markdown("<h2 style='text-align: center;'>لازم به ذکر است برای دریافت پروکسی ها بنا بر فیلتر شدن آدرس از فیلترشکن استفاده کنید</h2>", unsafe_allow_html=True)
|
| 7 |
+
|
| 8 |
+
# Input field for location
|
| 9 |
+
location = st.text_input("Enter your location:")
|
| 10 |
+
|
| 11 |
+
# Button to fetch data
|
| 12 |
+
if st.button("Give me Proxy!"):
|
| 13 |
+
if location.strip().lower() == "iran":
|
| 14 |
+
try:
|
| 15 |
+
response = requests.get('https://mtpro.xyz/api/?type=mtproto')
|
| 16 |
+
data = response.json()
|
| 17 |
+
results = st.empty()
|
| 18 |
+
results.empty()
|
| 19 |
+
results.markdown("<div class='result'>", unsafe_allow_html=True)
|
| 20 |
+
for i in range(min(20, len(data))):
|
| 21 |
+
proxy_link = f"https://t.me/proxy?server={data[i]['host']}&port={data[i]['port']}&secret={data[i]['secret']}"
|
| 22 |
+
results.markdown(f"<p>Proxy Link: <a href='{proxy_link}'>{proxy_link}</a></p>", unsafe_allow_html=True)
|
| 23 |
+
results.markdown("</div>", unsafe_allow_html=True)
|
| 24 |
+
except Exception as e:
|
| 25 |
+
st.error(f"Error giving Proxy :( : {e}")
|
| 26 |
+
else:
|
| 27 |
+
st.error("شما باید 'Iran' را در ورودی وارد کنید.")
|