File size: 1,434 Bytes
fc5c096
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
761bc1b
 
 
fc5c096
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import streamlit as st
import requests

# Set page title and background color
st.title("MTProto KayH GNG Collector")
st.markdown("<h2 style='text-align: center;'>لازم به ذکر است برای دریافت پروکسی ها بنا بر فیلتر شدن آدرس از فیلترشکن استفاده کنید</h2>", unsafe_allow_html=True)

# Input field for location
location = st.text_input("Enter your location:")

# Button to fetch data
if st.button("Give me Proxy!"):
    if location.strip().lower() == "iran":
        try:
            response = requests.get('https://mtpro.xyz/api/?type=mtproto')
            data = response.json()
            st.write("Data fetched from API:")
            st.write(data)  # Debug statement to display fetched data

            results = st.empty()
            results.empty()
            results.markdown("<div class='result'>", unsafe_allow_html=True)
            for i in range(min(20, len(data))):
                proxy_link = f"https://t.me/proxy?server={data[i]['host']}&port={data[i]['port']}&secret={data[i]['secret']}"
                results.markdown(f"<p>Proxy Link: <a href='{proxy_link}'>{proxy_link}</a></p>", unsafe_allow_html=True)
            results.markdown("</div>", unsafe_allow_html=True)
        except Exception as e:
            st.error(f"Error giving Proxy :( : {e}")
    else:
        st.error("شما باید 'Iran' را در ورودی وارد کنید.")