Spaces:
Paused
Paused
Update streamlit_app.py
Browse files- streamlit_app.py +14 -26
streamlit_app.py
CHANGED
|
@@ -6,8 +6,17 @@ from datetime import datetime
|
|
| 6 |
from pathlib import Path
|
| 7 |
import requests
|
| 8 |
|
|
|
|
| 9 |
st.set_page_config(page_title="TikTok Live Recorder", page_icon="📹", layout="wide")
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
st.markdown("""
|
| 12 |
<style>
|
| 13 |
.main-header {font-size: 2.5rem; font-weight: bold; background: linear-gradient(90deg, #ff0050, #00f2ea); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
|
|
@@ -19,6 +28,7 @@ st.markdown("""
|
|
| 19 |
</style>
|
| 20 |
""", unsafe_allow_html=True)
|
| 21 |
|
|
|
|
| 22 |
if 'recording' not in st.session_state:
|
| 23 |
st.session_state.recording = False
|
| 24 |
if 'process' not in st.session_state:
|
|
@@ -91,9 +101,11 @@ def upload_to_telegram(file_path, bot_token, chat_id):
|
|
| 91 |
except Exception as e:
|
| 92 |
return {'success': False, 'error': str(e)}
|
| 93 |
|
|
|
|
| 94 |
st.markdown('<h1 class="main-header">📹 TikTok Live Recorder</h1>', unsafe_allow_html=True)
|
| 95 |
st.markdown("Record TikTok live streams with free unlimited upload to Telegram")
|
| 96 |
|
|
|
|
| 97 |
username_input = st.text_input("TikTok Username (without @)")
|
| 98 |
|
| 99 |
col1, col2, col3 = st.columns(3)
|
|
@@ -185,29 +197,5 @@ st.markdown("**⚠️ Notes:** Recordings are temporary. User must be LIVE. Resp
|
|
| 185 |
|
| 186 |
with st.sidebar:
|
| 187 |
st.markdown("### ℹ️ Info")
|
| 188 |
-
st.write("**
|
| 189 |
-
st.
|
| 190 |
-
st.info("Enter Telegram credentials after recording to upload")
|
| 191 |
-
|
| 192 |
-
with st.expander("📖 How to Setup Telegram"):
|
| 193 |
-
st.markdown("""
|
| 194 |
-
### Step 1: Create Bot
|
| 195 |
-
1. Open Telegram
|
| 196 |
-
2. Search @BotFather
|
| 197 |
-
3. Send /newbot
|
| 198 |
-
4. Save the Token
|
| 199 |
-
|
| 200 |
-
### Step 2: Create Channel
|
| 201 |
-
1. New Channel in Telegram
|
| 202 |
-
2. Add your bot as Admin
|
| 203 |
-
|
| 204 |
-
### Step 3: Get Chat ID
|
| 205 |
-
1. Search @getmyid_bot
|
| 206 |
-
2. Send any message
|
| 207 |
-
3. Copy Current Chat ID
|
| 208 |
-
|
| 209 |
-
### File Size Limits
|
| 210 |
-
- Free: 2 GB per file
|
| 211 |
-
- Premium: 4 GB per file
|
| 212 |
-
- Storage: Unlimited
|
| 213 |
-
""")
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
import requests
|
| 8 |
|
| 9 |
+
# Page config MUST be first
|
| 10 |
st.set_page_config(page_title="TikTok Live Recorder", page_icon="📹", layout="wide")
|
| 11 |
|
| 12 |
+
# Loading screen
|
| 13 |
+
@st.cache_resource
|
| 14 |
+
def load_resources():
|
| 15 |
+
return True
|
| 16 |
+
|
| 17 |
+
if not load_resources():
|
| 18 |
+
st.spinner("Loading resources...")
|
| 19 |
+
|
| 20 |
st.markdown("""
|
| 21 |
<style>
|
| 22 |
.main-header {font-size: 2.5rem; font-weight: bold; background: linear-gradient(90deg, #ff0050, #00f2ea); -webkit-background-clip: text; -webkit-text-fill-color: transparent;}
|
|
|
|
| 28 |
</style>
|
| 29 |
""", unsafe_allow_html=True)
|
| 30 |
|
| 31 |
+
# Session state
|
| 32 |
if 'recording' not in st.session_state:
|
| 33 |
st.session_state.recording = False
|
| 34 |
if 'process' not in st.session_state:
|
|
|
|
| 101 |
except Exception as e:
|
| 102 |
return {'success': False, 'error': str(e)}
|
| 103 |
|
| 104 |
+
# Main UI
|
| 105 |
st.markdown('<h1 class="main-header">📹 TikTok Live Recorder</h1>', unsafe_allow_html=True)
|
| 106 |
st.markdown("Record TikTok live streams with free unlimited upload to Telegram")
|
| 107 |
|
| 108 |
+
st.markdown("### 🔗 Connect to Live Stream")
|
| 109 |
username_input = st.text_input("TikTok Username (without @)")
|
| 110 |
|
| 111 |
col1, col2, col3 = st.columns(3)
|
|
|
|
| 197 |
|
| 198 |
with st.sidebar:
|
| 199 |
st.markdown("### ℹ️ Info")
|
| 200 |
+
st.write("**Status:** Online")
|
| 201 |
+
st.info("Enter Telegram credentials after recording to upload")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|