Mohammed Foud commited on
Commit
2bf7cb2
·
1 Parent(s): e9a4c2e

Add application file

Browse files
Dockerfile CHANGED
@@ -24,6 +24,5 @@ RUN pip install --no-cache-dir --upgrade -r requirements.txt
24
  # Copy the rest of the app
25
  COPY --chown=user . /app
26
 
27
- # CMD ["python3", "telegram_bot.py"]
28
 
29
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
24
  # Copy the rest of the app
25
  COPY --chown=user . /app
26
 
 
27
 
28
+ CMD ["python3", "tiktok.py"]
LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 ༺ | 𝘾𝙮𝙗𝙚𝙧𝙨𝙚𝙘𝙪𝙧𝙞𝙩𝙮 | ༻ ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ╭༻━➖━༺╮ ㅤㅤㅤ   ㅤ𝒵𝑒𝒷𝒶𝓈𝓉𝒾𝒶𝓃 ㅤㅤㅤㅤ╰༻━➖━༺╯ㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤㅤ
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
__pycache__/telbot.cpython-312.pyc ADDED
Binary file (21.5 kB). View file
 
__pycache__/telegram_bot.cpython-312.pyc CHANGED
Binary files a/__pycache__/telegram_bot.cpython-312.pyc and b/__pycache__/telegram_bot.cpython-312.pyc differ
 
app.py DELETED
@@ -1,302 +0,0 @@
1
- import asyncio
2
- import threading
3
- from telegram import Update
4
- import uvicorn
5
- from typing import Optional
6
- from fastapi import FastAPI, HTTPException, BackgroundTasks
7
- from fastapi.responses import JSONResponse
8
- from pydantic import BaseModel
9
- import logging
10
- import sys
11
- import os
12
- from telegram_bot import TelegramTikTokBot, main as telegram_main
13
-
14
- # Configure logging
15
- logging.basicConfig(
16
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
17
- level=logging.INFO
18
- )
19
- logger = logging.getLogger(__name__)
20
-
21
- # Create FastAPI app
22
- app = FastAPI(
23
- title="TikTok Telegram Bot API",
24
- description="API to control TikTok Telegram Bot",
25
- version="1.0.0"
26
- )
27
-
28
- # Global variables to track bot status
29
- bot_thread = None
30
- bot_running = False
31
- bot_instance = None
32
- bot_application = None
33
- bot_stop_flag = False
34
-
35
- class BotStartRequest(BaseModel):
36
- """Request model for starting the bot"""
37
- telegram_token: Optional[str] = None # Optional, will use default if not provided
38
- tiktok_email: Optional[str] = None # Optional, will use default if not provided
39
- tiktok_password: Optional[str] = None # Optional, will use default if not provided
40
-
41
- class BotResponse(BaseModel):
42
- """Response model for bot operations"""
43
- success: bool
44
- message: str
45
- bot_status: str = "stopped"
46
-
47
- @app.get("/")
48
- async def root():
49
- """Root endpoint"""
50
- return {
51
- "message": "TikTok Telegram Bot API",
52
- "version": "1.0.0",
53
- "endpoints": {
54
- "POST /runbottelegram": "Start the Telegram bot",
55
- "GET /status": "Get bot status",
56
- "POST /stopbot": "Stop the Telegram bot"
57
- }
58
- }
59
-
60
- @app.get("/status")
61
- async def get_bot_status():
62
- """Get the current status of the bot"""
63
- global bot_running, bot_instance, bot_application
64
-
65
- status = "running" if bot_running else "stopped"
66
-
67
- # Additional status information
68
- additional_info = ""
69
- if bot_running:
70
- if bot_instance and bot_application:
71
- additional_info = " (Bot and application are active)"
72
- else:
73
- additional_info = " (Bot starting up...)"
74
-
75
- return BotResponse(
76
- success=True,
77
- message=f"Bot is currently {status}{additional_info}",
78
- bot_status=status
79
- )
80
-
81
- @app.post("/runbottelegram")
82
- async def run_bot_telegram(request: BotStartRequest, background_tasks: BackgroundTasks):
83
- """Start the Telegram bot"""
84
- global bot_thread, bot_running, bot_instance
85
-
86
- if bot_running:
87
- raise HTTPException(
88
- status_code=400,
89
- detail="Bot is already running. Stop it first before starting a new instance."
90
- )
91
-
92
- try:
93
- # Update configuration if provided
94
- if request.telegram_token is not None:
95
- # Update the telegram_bot.py file with new token
96
- update_telegram_token(request.telegram_token)
97
-
98
- if request.tiktok_email is not None and request.tiktok_password is not None:
99
- # Update the telegram_bot.py file with new credentials
100
- update_tiktok_credentials(request.tiktok_email, request.tiktok_password)
101
-
102
- # Start bot in background thread
103
- bot_running = True
104
- bot_stop_flag = False
105
- bot_thread = threading.Thread(target=run_telegram_bot, daemon=True)
106
- bot_thread.start()
107
-
108
- # Wait a moment to ensure bot starts properly
109
- await asyncio.sleep(2)
110
-
111
- return BotResponse(
112
- success=True,
113
- message="Telegram bot started successfully! The bot is now running and ready to receive commands.",
114
- bot_status="running"
115
- )
116
-
117
- except Exception as e:
118
- bot_running = False
119
- logger.error(f"Failed to start bot: {e}")
120
- raise HTTPException(
121
- status_code=500,
122
- detail=f"Failed to start bot: {str(e)}"
123
- )
124
-
125
- @app.post("/stopbot")
126
- async def stop_bot():
127
- """Stop the Telegram bot"""
128
- global bot_running, bot_instance, bot_thread, bot_application, bot_stop_flag
129
-
130
- if not bot_running:
131
- raise HTTPException(
132
- status_code=400,
133
- detail="Bot is not currently running."
134
- )
135
-
136
- try:
137
- # Set stop flag
138
- bot_stop_flag = True
139
- bot_running = False
140
-
141
- # Stop the telegram application
142
- if bot_application and bot_instance:
143
- try:
144
- bot_instance.stop_application(bot_application)
145
- except Exception as e:
146
- logger.error(f"Error stopping telegram application: {e}")
147
-
148
- # Cleanup bot instance
149
- if bot_instance:
150
- try:
151
- bot_instance.cleanup()
152
- except Exception as e:
153
- logger.error(f"Error during bot cleanup: {e}")
154
-
155
- bot_instance = None
156
- bot_application = None
157
-
158
- # Wait for thread to finish (with timeout)
159
- if bot_thread and bot_thread.is_alive():
160
- bot_thread.join(timeout=10)
161
-
162
- # Force terminate if still alive
163
- if bot_thread.is_alive():
164
- logger.warning("Bot thread did not stop gracefully, forcing termination")
165
-
166
- return BotResponse(
167
- success=True,
168
- message="Bot stopped successfully",
169
- bot_status="stopped"
170
- )
171
-
172
- except Exception as e:
173
- logger.error(f"Failed to stop bot: {e}")
174
- # Reset state even if error occurred
175
- bot_running = False
176
- bot_instance = None
177
- bot_application = None
178
- bot_stop_flag = False
179
- raise HTTPException(
180
- status_code=500,
181
- detail=f"Failed to stop bot: {str(e)}"
182
- )
183
-
184
- def run_telegram_bot():
185
- """Run the Telegram bot in a separate thread"""
186
- telegram_main()
187
- # global bot_running, bot_instance, bot_application, bot_stop_flag
188
-
189
- # try:
190
- # # Import and run the telegram bot
191
- # from telegram_bot import TelegramTikTokBot, create_application, setup_handlers
192
-
193
- # # Create application and bot instance
194
- # application = create_application()
195
- # bot_application = application
196
- # bot_instance = TelegramTikTokBot()
197
-
198
- # # Setup handlers
199
- # setup_handlers(application, bot_instance)
200
-
201
- # # Start the bot
202
- # logger.info("🤖 Starting Telegram TikTok Bot...")
203
- # logger.info("📱 Bot is now running. Send /start to begin!")
204
-
205
- # # Run the bot synchronously without signal handlers
206
- # try:
207
- # application.run_polling(
208
- # allowed_updates=Update.ALL_TYPES,
209
- # close_loop=False,
210
- # drop_pending_updates=True
211
- # )
212
- # except KeyboardInterrupt:
213
- # logger.info("Bot stopped by interrupt")
214
- # except Exception as e:
215
- # logger.error(f"Bot polling error: {e}")
216
-
217
- # except Exception as e:
218
- # logger.error(f"Error in telegram bot thread: {e}")
219
- # finally:
220
- # bot_running = False
221
- # bot_instance = None
222
- # bot_application = None
223
- # logger.info("Bot thread finished")
224
-
225
- def update_telegram_token(token: str):
226
- """Update the telegram token in telegram_bot.py"""
227
- try:
228
- with open('telegram_bot.py', 'r', encoding='utf-8') as file:
229
- content = file.read()
230
-
231
- # Replace the token line
232
- import re
233
- updated_content = re.sub(
234
- r'TELEGRAM_TOKEN = "[^"]*"',
235
- f'TELEGRAM_TOKEN = "{token}"',
236
- content
237
- )
238
-
239
- with open('telegram_bot.py', 'w', encoding='utf-8') as file:
240
- file.write(updated_content)
241
-
242
- logger.info("Telegram token updated successfully")
243
-
244
- except Exception as e:
245
- logger.error(f"Failed to update telegram token: {e}")
246
- raise
247
-
248
- def update_tiktok_credentials(email: str, password: str):
249
- """Update TikTok credentials in telegram_bot.py"""
250
- try:
251
- with open('telegram_bot.py', 'r', encoding='utf-8') as file:
252
- content = file.read()
253
-
254
- # Replace email and password lines
255
- import re
256
- updated_content = re.sub(
257
- r'EMAIL = "[^"]*"',
258
- f'EMAIL = "{email}"',
259
- content
260
- )
261
- updated_content = re.sub(
262
- r'PASSWORD = "[^"]*"',
263
- f'PASSWORD = "{password}"',
264
- content
265
- )
266
-
267
- with open('telegram_bot.py', 'w', encoding='utf-8') as file:
268
- file.write(updated_content)
269
-
270
- logger.info("TikTok credentials updated successfully")
271
-
272
- except Exception as e:
273
- logger.error(f"Failed to update TikTok credentials: {e}")
274
- raise
275
-
276
- @app.exception_handler(Exception)
277
- async def global_exception_handler(request, exc):
278
- """Global exception handler"""
279
- logger.error(f"Global exception: {exc}")
280
- return JSONResponse(
281
- status_code=500,
282
- content={"success": False, "message": f"Internal server error: {str(exc)}"}
283
- )
284
-
285
- if __name__ == "__main__":
286
- # Run the FastAPI server
287
- print("🚀 Starting FastAPI server on port 7860...")
288
- print("📡 API endpoints:")
289
- print(" GET / - API information")
290
- print(" GET /status - Check bot status")
291
- print(" POST /runbottelegram - Start Telegram bot")
292
- print(" POST /stopbot - Stop Telegram bot")
293
- print("\n🌐 Server will be available at: http://localhost:7860")
294
- print("📚 API documentation at: http://localhost:7860/docs")
295
-
296
- uvicorn.run(
297
- "fastapi_server:app",
298
- host="0.0.0.0",
299
- port=7860,
300
- reload=False,
301
- log_level="info"
302
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
commented_videos.json CHANGED
@@ -1 +1,5 @@
1
- ["https://www.tiktok.com/@._253800/video/7518993710592429330?is_from_webapp=1&sender_device=pc", "https://www.tiktok.com/@abuamsl/video/7522856538034212117?is_from_webapp=1&sender_device=pc"]
 
 
 
 
 
1
+ [
2
+ "https://www.tiktok.com/@yemn61/video/7523966949387242782?is_from_webapp=1&sender_device=pc",
3
+ "https://www.tiktok.com/@abuamsl/video/7522856538034212117?is_from_webapp=1&sender_device=pc",
4
+ "https://www.tiktok.com/@._253800/video/7518993710592429330?is_from_webapp=1&sender_device=pc"
5
+ ]
s.sh → run.sh RENAMED
File without changes
setup_telegram_bot.py DELETED
@@ -1,106 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Setup script for Telegram TikTok Bot
4
- This script helps you configure the bot with your Telegram token.
5
- """
6
-
7
- import os
8
- import re
9
-
10
- def get_telegram_token():
11
- """Get Telegram bot token from user"""
12
- print("🤖 Telegram TikTok Bot Setup")
13
- print("=" * 40)
14
- print()
15
- print("To get your Telegram bot token:")
16
- print("1. Open Telegram and search for @BotFather")
17
- print("2. Send /newbot command")
18
- print("3. Follow the instructions to create your bot")
19
- print("4. Copy the token that BotFather gives you")
20
- print()
21
-
22
- while True:
23
- token = input("Enter your Telegram bot token: ").strip()
24
-
25
- # Basic token validation (Telegram tokens are typically 46 characters)
26
- if len(token) > 40 and ":" in token:
27
- return token
28
- else:
29
- print("❌ Invalid token format. Please check your token and try again.")
30
-
31
- def update_telegram_bot_file(token):
32
- """Update the telegram_bot.py file with the provided token"""
33
- try:
34
- with open('telegram_bot.py', 'r', encoding='utf-8') as file:
35
- content = file.read()
36
-
37
- # Replace the placeholder token
38
- updated_content = content.replace(
39
- 'TELEGRAM_TOKEN = "YOUR_TELEGRAM_BOT_TOKEN"',
40
- f'TELEGRAM_TOKEN = "{token}"'
41
- )
42
-
43
- with open('telegram_bot.py', 'w', encoding='utf-8') as file:
44
- file.write(updated_content)
45
-
46
- print("✅ Telegram bot token updated successfully!")
47
- return True
48
-
49
- except Exception as e:
50
- print(f"❌ Error updating telegram_bot.py: {e}")
51
- return False
52
-
53
- def check_dependencies():
54
- """Check if required dependencies are installed"""
55
- print("\n📦 Checking dependencies...")
56
-
57
- try:
58
- import telegram
59
- print("✅ python-telegram-bot is installed")
60
- except ImportError:
61
- print("❌ python-telegram-bot is not installed")
62
- print(" Run: pip install -r telegram_requirements.txt")
63
- return False
64
-
65
- try:
66
- import selenium
67
- print("✅ selenium is installed")
68
- except ImportError:
69
- print("❌ selenium is not installed")
70
- print(" Run: pip install -r telegram_requirements.txt")
71
- return False
72
-
73
- return True
74
-
75
- def main():
76
- """Main setup function"""
77
- print("🚀 Welcome to Telegram TikTok Bot Setup!")
78
- print()
79
-
80
- # Check dependencies
81
- if not check_dependencies():
82
- print("\n❌ Please install the required dependencies first.")
83
- print("Run: pip install -r telegram_requirements.txt")
84
- return
85
-
86
- # Get token from user
87
- token = get_telegram_token()
88
-
89
- # Update the bot file
90
- if update_telegram_bot_file(token):
91
- print("\n🎉 Setup completed successfully!")
92
- print("\nNext steps:")
93
- print("1. Make sure Chrome/Chromium is installed on your system")
94
- print("2. Run the bot: python telegram_bot.py")
95
- print("3. Open Telegram and find your bot")
96
- print("4. Send /start to begin using the bot")
97
- print("\n📝 Note: The bot will ask for:")
98
- print(" - TikTok video URL")
99
- print(" - Comment text to post")
100
- print("\n⚠️ Important: Make sure to update the EMAIL and PASSWORD")
101
- print(" in telegram_bot.py with your TikTok credentials!")
102
- else:
103
- print("\n❌ Setup failed. Please try again.")
104
-
105
- if __name__ == "__main__":
106
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
telegram_bot.py DELETED
@@ -1,323 +0,0 @@
1
- import os
2
- import logging
3
- import time
4
- import json
5
- import random
6
- from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
7
- from telegram.ext import Application, CommandHandler, MessageHandler, CallbackQueryHandler, ContextTypes, filters
8
- from selenium import webdriver
9
- from selenium.webdriver.chrome.options import Options
10
- from tiktok import TikTokBot
11
-
12
- # Configure logging
13
- logging.basicConfig(
14
- format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
15
- level=logging.INFO
16
- )
17
- logger = logging.getLogger(__name__)
18
-
19
- # Configuration
20
- TELEGRAM_TOKEN = "7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4" # Replace with your Telegram bot token
21
- EMAIL = "foudmohammed914@gmail.com"
22
- PASSWORD = "009988Ppooii@@@@"
23
- COOKIES_FILE = 'tiktok_cookies.json'
24
- COMMENTED_FILE = 'commented_videos.json'
25
-
26
- # User states for conversation flow
27
- USER_STATES = {}
28
-
29
- class TelegramTikTokBot:
30
- def __init__(self):
31
- self.driver = None
32
- self.tiktok_bot = None
33
- self.setup_driver()
34
-
35
- def setup_driver(self):
36
- """Initialize the Chrome WebDriver"""
37
- try:
38
- project_dir = os.path.dirname(os.path.abspath(__file__))
39
- cache_dir = os.path.join(project_dir, "selenium_cache")
40
-
41
- if not os.path.exists(cache_dir):
42
- os.makedirs(cache_dir)
43
- logger.info(f"Created Selenium cache directory: {cache_dir}")
44
-
45
- chrome_options = Options()
46
- chrome_options.add_argument("--start-maximized")
47
- chrome_options.add_argument("--headless")
48
- chrome_options.add_argument("--disable-blink-features=AutomationControlled")
49
- chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
50
- chrome_options.add_experimental_option('useAutomationExtension', False)
51
- chrome_options.add_argument(f"user-data-dir={cache_dir}")
52
- chrome_options.add_argument("--log-level=3")
53
- chrome_options.add_argument("--disable-logging")
54
- chrome_options.add_experimental_option('excludeSwitches', ['enable-logging'])
55
-
56
- self.driver = webdriver.Chrome(options=chrome_options)
57
- logger.info("Chrome WebDriver initialized successfully")
58
-
59
- # Initialize TikTokBot
60
- self.tiktok_bot = TikTokBot(
61
- driver=self.driver,
62
- comments=[], # We'll use custom comments
63
- hashtags=[], # Not needed for single video commenting
64
- login_email=EMAIL,
65
- login_password=PASSWORD,
66
- cookies_file=COOKIES_FILE,
67
- commented_file=COMMENTED_FILE
68
- )
69
-
70
- except Exception as e:
71
- logger.error(f"Failed to initialize WebDriver: {e}")
72
- self.driver = None
73
- self.tiktok_bot = None
74
-
75
- async def start(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
76
- """Send a message when the command /start is issued."""
77
- user_id = update.effective_user.id
78
- USER_STATES[user_id] = "waiting_for_video_url"
79
-
80
- welcome_message = (
81
- "🤖 Welcome to TikTok Comment Bot!\n\n"
82
- "I can help you post comments on TikTok videos.\n\n"
83
- "Please send me the TikTok video URL you want to comment on:"
84
- )
85
-
86
- await update.message.reply_text(welcome_message)
87
-
88
- async def handle_video_url(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
89
- """Handle the video URL input"""
90
- user_id = update.effective_user.id
91
-
92
- if user_id not in USER_STATES or USER_STATES[user_id] != "waiting_for_video_url":
93
- await update.message.reply_text("Please use /start to begin.")
94
- return
95
-
96
- video_url = update.message.text.strip()
97
-
98
- # Basic URL validation
99
- if not video_url.startswith("https://www.tiktok.com/") or "/video/" not in video_url:
100
- await update.message.reply_text(
101
- "❌ Invalid TikTok video URL. Please send a valid TikTok video URL that contains '/video/' in the link."
102
- )
103
- return
104
-
105
- # Store the video URL and ask for comment
106
- context.user_data['video_url'] = video_url
107
- USER_STATES[user_id] = "waiting_for_comment"
108
-
109
- await update.message.reply_text(
110
- f"✅ Video URL received: {video_url}\n\n"
111
- "Now please send me the comment you want to post:"
112
- )
113
-
114
- async def handle_message(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
115
- """Handle incoming messages and route them appropriately"""
116
- user_id = update.effective_user.id
117
-
118
- if user_id not in USER_STATES:
119
- await update.message.reply_text("Please use /start to begin.")
120
- return
121
-
122
- if USER_STATES[user_id] == "waiting_for_video_url":
123
- await self.handle_video_url(update, context)
124
- elif USER_STATES[user_id] == "waiting_for_comment":
125
- await self.handle_comment(update, context)
126
-
127
- async def handle_comment(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
128
- """Handle the comment input and post it"""
129
- user_id = update.effective_user.id
130
-
131
- if user_id not in USER_STATES or USER_STATES[user_id] != "waiting_for_comment":
132
- await update.message.reply_text("Please use /start to begin.")
133
- return
134
-
135
- custom_comment = update.message.text.strip()
136
- video_url = context.user_data.get('video_url')
137
-
138
- if not video_url:
139
- await update.message.reply_text("❌ No video URL found. Please use /start to begin again.")
140
- return
141
-
142
- if not custom_comment:
143
- await update.message.reply_text("❌ Comment cannot be empty. Please send a valid comment.")
144
- return
145
-
146
- # Clear user state
147
- USER_STATES[user_id] = None
148
-
149
- # Show processing message
150
- processing_msg = await update.message.reply_text(
151
- "🔄 Processing your request...\n"
152
- "This may take a few moments."
153
- )
154
-
155
- try:
156
- # Check if driver is available
157
- if not self.driver or not self.tiktok_bot:
158
- await processing_msg.edit_text("❌ Bot is not properly initialized. Please try again later.")
159
- return
160
-
161
- # Login to TikTok
162
- await processing_msg.edit_text("🔐 Logging into TikTok...")
163
- self.tiktok_bot.login()
164
-
165
- # Post the comment
166
- await processing_msg.edit_text("💬 Posting your comment...")
167
- success = self.tiktok_bot.post_comment_on_video(video_url, custom_comment)
168
-
169
- if success:
170
- result_message = (
171
- "✅ Comment posted successfully!\n\n"
172
- f"📹 Video: {video_url}\n"
173
- f"💬 Comment: {custom_comment}\n\n"
174
- "The comment has been posted to the TikTok video."
175
- )
176
- else:
177
- result_message = (
178
- "❌ Failed to post comment.\n\n"
179
- f"📹 Video: {video_url}\n"
180
- f"💬 Comment: {custom_comment}\n\n"
181
- "Possible reasons:\n"
182
- "• Video URL is invalid or private\n"
183
- "• Comment box not found\n"
184
- "• TikTok detected automated behavior\n"
185
- "• Network issues\n\n"
186
- "Please try again later or check the video URL."
187
- )
188
-
189
- await processing_msg.edit_text(result_message)
190
-
191
- except Exception as e:
192
- logger.error(f"Error posting comment: {e}")
193
- await processing_msg.edit_text(
194
- f"❌ An error occurred while posting the comment:\n\n"
195
- f"Error: {str(e)}\n\n"
196
- "Please try again later or contact support."
197
- )
198
-
199
- async def help_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
200
- """Send a message when the command /help is issued."""
201
- help_text = (
202
- "🤖 TikTok Comment Bot Help\n\n"
203
- "Commands:\n"
204
- "/start - Start the bot and post a comment\n"
205
- "/help - Show this help message\n"
206
- "/status - Check bot status\n\n"
207
- "How to use:\n"
208
- "1. Use /start to begin\n"
209
- "2. Send a TikTok video URL\n"
210
- "3. Send your comment text\n"
211
- "4. Wait for the bot to post your comment\n\n"
212
- "Note: Make sure the TikTok video is public and accessible."
213
- )
214
- await update.message.reply_text(help_text)
215
-
216
- async def status_command(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
217
- """Check bot status"""
218
- if self.driver and self.tiktok_bot:
219
- status = "✅ Bot is ready and connected"
220
- else:
221
- status = "❌ Bot is not properly initialized"
222
-
223
- await update.message.reply_text(f"🤖 Bot Status: {status}")
224
-
225
- async def handle_unknown_message(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
226
- """Handle unknown messages"""
227
- user_id = update.effective_user.id
228
-
229
- if user_id in USER_STATES:
230
- if USER_STATES[user_id] == "waiting_for_video_url":
231
- await update.message.reply_text("Please send a valid TikTok video URL.")
232
- elif USER_STATES[user_id] == "waiting_for_comment":
233
- await update.message.reply_text("Please send the comment you want to post.")
234
- else:
235
- await update.message.reply_text(
236
- "Please use /start to begin posting comments, or /help for more information."
237
- )
238
-
239
- def cleanup(self):
240
- """Clean up resources"""
241
- if self.driver:
242
- try:
243
- self.driver.quit()
244
- logger.info("WebDriver closed successfully")
245
- except Exception as e:
246
- logger.error(f"Error closing WebDriver: {e}")
247
-
248
- def stop_application(self, application):
249
- """Stop the telegram application"""
250
- try:
251
- if application:
252
- logger.info("Application stop requested")
253
- except Exception as e:
254
- logger.error(f"Error stopping telegram application: {e}")
255
-
256
- def create_application():
257
- """Create and configure the Telegram application"""
258
- # Check if Telegram token is set
259
- if TELEGRAM_TOKEN == "YOUR_TELEGRAM_BOT_TOKEN":
260
- raise ValueError("Please set your Telegram bot token in the TELEGRAM_TOKEN variable!")
261
-
262
- # Create the Application with custom settings to avoid signal handler issues
263
- application = (
264
- Application.builder()
265
- .token(TELEGRAM_TOKEN)
266
- .arbitrary_callback_data(True)
267
- .build()
268
- )
269
-
270
- return application
271
-
272
- def setup_handlers(application, bot_instance):
273
- """Setup all handlers for the application"""
274
- # Add handlers
275
- application.add_handler(CommandHandler("start", bot_instance.start))
276
- application.add_handler(CommandHandler("help", bot_instance.help_command))
277
- application.add_handler(CommandHandler("status", bot_instance.status_command))
278
-
279
- # Add message handlers with proper routing
280
- application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, bot_instance.handle_message))
281
-
282
- # Add unknown message handler
283
- application.add_handler(MessageHandler(filters.ALL, bot_instance.handle_unknown_message))
284
-
285
- def run_bot():
286
- """Run the bot with proper setup"""
287
- try:
288
- # Create application
289
- application = create_application()
290
-
291
- # Create bot instance
292
- bot_instance = TelegramTikTokBot()
293
-
294
- # Setup handlers
295
- setup_handlers(application, bot_instance)
296
-
297
- # Start the bot
298
- print("🤖 Starting Telegram TikTok Bot...")
299
- print("📱 Bot is now running. Send /start to begin!")
300
-
301
- # Run the bot synchronously with proper settings
302
- application.run_polling(
303
- allowed_updates=Update.ALL_TYPES,
304
- close_loop=False,
305
- drop_pending_updates=True
306
- )
307
-
308
- except KeyboardInterrupt:
309
- print("\n🛑 Bot stopped by user")
310
- except Exception as e:
311
- print(f"❌ Error running bot: {e}")
312
- finally:
313
- if 'bot_instance' in locals():
314
- bot_instance.cleanup()
315
-
316
-
317
-
318
- def main():
319
- """Main function to start the bot"""
320
- run_bot()
321
-
322
- if __name__ == '__main__':
323
- main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
test_api.py DELETED
@@ -1,118 +0,0 @@
1
- #!/usr/bin/env python3
2
- """
3
- Test script for FastAPI TikTok Telegram Bot
4
- This script demonstrates how to use the API endpoints.
5
- """
6
-
7
- import requests
8
- import json
9
- import time
10
-
11
- # API base URL
12
- BASE_URL = "http://localhost:7860"
13
-
14
- def test_api():
15
- """Test the FastAPI endpoints"""
16
-
17
- print("🧪 Testing TikTok Telegram Bot API")
18
- print("=" * 50)
19
-
20
- # # Test 1: Get API info
21
- # print("\n1️⃣ Testing GET /")
22
- # try:
23
- # response = requests.get(f"{BASE_URL}/")
24
- # print(f"Status: {response.status_code}")
25
- # print(f"Response: {json.dumps(response.json(), indent=2)}")
26
- # except Exception as e:
27
- # print(f"❌ Error: {e}")
28
-
29
- # # Test 2: Check bot status
30
- # print("\n2️⃣ Testing GET /status")
31
- # try:
32
- # response = requests.get(f"{BASE_URL}/status")
33
- # print(f"Status: {response.status_code}")
34
- # print(f"Response: {json.dumps(response.json(), indent=2)}")
35
- # except Exception as e:
36
- # print(f"❌ Error: {e}")
37
-
38
- # Test 3: Start bot (optional parameters)
39
- print("\n3️⃣ Testing POST /runbottelegram")
40
- try:
41
- # You can provide custom credentials or leave them out to use defaults
42
- payload = {} # Empty payload will use defaults from telegram_bot.py
43
-
44
- response = requests.post(
45
- f"{BASE_URL}/runbottelegram",
46
- json=payload,
47
- headers={"Content-Type": "application/json"}
48
- )
49
- print(f"Status: {response.status_code}")
50
- print(f"Response: {json.dumps(response.json(), indent=2)}")
51
-
52
- if response.status_code == 200:
53
- print("✅ Bot started successfully!")
54
-
55
- # Wait a moment and check status
56
- time.sleep(3)
57
- status_response = requests.get(f"{BASE_URL}/status")
58
- print(f"Updated status: {json.dumps(status_response.json(), indent=2)}")
59
-
60
- except Exception as e:
61
- print(f"❌ Error: {e}")
62
-
63
- # Test 4: Stop bot
64
- # print("\n4️⃣ Testing POST /stopbot")
65
- # try:
66
- # response = requests.post(f"{BASE_URL}/stopbot")
67
- # print(f"Status: {response.status_code}")
68
- # print(f"Response: {json.dumps(response.json(), indent=2)}")
69
- # except Exception as e:
70
- # print(f"❌ Error: {e}")
71
-
72
- def test_with_custom_credentials():
73
- """Test starting bot with custom credentials"""
74
- print("\n🔧 Testing with custom credentials")
75
- print("=" * 50)
76
-
77
- try:
78
- payload = {
79
- "telegram_token": "7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4", # Replace with actual token
80
- "tiktok_email": "your_email@example.com", # Replace with actual email
81
- "tiktok_password": "your_password" # Replace with actual password
82
- }
83
-
84
- # Note: You can also omit any field to use defaults
85
- # payload = {
86
- # "telegram_token": "YOUR_CUSTOM_TOKEN_HERE" # Only update token, use defaults for others
87
- # }
88
-
89
- print("⚠️ Note: This test uses placeholder credentials.")
90
- print(" Replace them with real values to test custom configuration.")
91
-
92
- response = requests.post(
93
- f"{BASE_URL}/runbottelegram",
94
- json=payload,
95
- headers={"Content-Type": "application/json"}
96
- )
97
- print(f"Status: {response.status_code}")
98
- print(f"Response: {json.dumps(response.json(), indent=2)}")
99
-
100
- except Exception as e:
101
- print(f"❌ Error: {e}")
102
-
103
- if __name__ == "__main__":
104
- print("🚀 TikTok Telegram Bot API Test")
105
- print("Make sure the FastAPI server is running on port 7860")
106
- print("Run: python fastapi_server.py")
107
- print()
108
-
109
- # Test basic functionality
110
- test_api()
111
-
112
- # Uncomment to test with custom credentials
113
- # test_with_custom_credentials()
114
-
115
- print("\n✅ Testing completed!")
116
- print("\n📚 For more information:")
117
- print(" - API docs: http://localhost:7860/docs")
118
- print(" - Alternative docs: http://localhost:7860/redoc")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tiktok.py CHANGED
@@ -52,42 +52,13 @@ logging.basicConfig(
52
  # -------------------- End Logging Configuration -------------------- #
53
 
54
  class TikTokBot:
55
- def __init__(self, driver, comments, hashtags, login_email, login_password, cookies_file='tiktok_cookies.json', commented_file='commented_videos.json'):
56
  self.driver = driver
57
- self.comments = comments
58
- self.hashtags = hashtags
59
  self.login_email = login_email
60
  self.login_password = login_password
61
  self.cookies_file = cookies_file
62
  self.commented_file = commented_file
63
- self.commented_videos = self.load_commented_videos()
64
 
65
- def load_commented_videos(self):
66
- """Loads the list of commented videos from a JSON file."""
67
- if os.path.exists(self.commented_file):
68
- try:
69
- with open(self.commented_file, 'r', encoding='utf-8') as file:
70
- data = json.load(file)
71
- logging.info(f"Loaded {len(data)} previously commented videos.")
72
- return set(data)
73
- except json.JSONDecodeError:
74
- logging.error("Commented videos file contains invalid JSON. Starting fresh.")
75
- return set()
76
- except Exception as e:
77
- logging.error(f"Failed to load commented videos: {e}")
78
- return set()
79
- else:
80
- logging.info("No commented videos file found. Starting fresh.")
81
- return set()
82
-
83
- def save_commented_videos(self):
84
- """Saves the list of commented videos to a JSON file."""
85
- try:
86
- with open(self.commented_file, 'w', encoding='utf-8') as file:
87
- json.dump(list(self.commented_videos), file)
88
- logging.info("Commented videos have been saved successfully.")
89
- except Exception as e:
90
- logging.error(f"Failed to save commented videos: {e}")
91
 
92
  def save_cookies(self):
93
  """Saves cookies to a JSON file."""
@@ -157,7 +128,7 @@ class TikTokBot:
157
 
158
  def login(self):
159
  """Logs into TikTok using cookies if available, otherwise performs manual login."""
160
- self.driver.get("https://www.tiktok.com/login")
161
  if self.load_cookies():
162
  self.driver.refresh()
163
  time.sleep(random.uniform(3, 6))
@@ -191,7 +162,7 @@ class TikTokBot:
191
 
192
  # Wait for login to complete by checking URL change or presence of a user avatar
193
  WebDriverWait(self.driver, 30).until(
194
- EC.url_changes("https://www.tiktok.com/login")
195
  )
196
  time.sleep(random.uniform(3, 5)) # Allow time for the page to fully load
197
 
@@ -269,82 +240,6 @@ class TikTokBot:
269
  self.capture_screenshot("general_error")
270
  return False
271
 
272
- def post_comments_on_hashtags(self, max_comments_per_hashtag=3):
273
- """Navigates through specified hashtags and posts comments on videos."""
274
- for hashtag in self.hashtags:
275
- logging.info(f"Processing hashtag: #{hashtag}")
276
- hashtag_url = f"https://www.tiktok.com/tag/{hashtag}"
277
- self.driver.get(hashtag_url)
278
- time.sleep(random.uniform(5, 8)) # Allow page to load
279
-
280
- # Scroll to load enough videos
281
- for _ in range(3): # Adjust the range for more scrolling
282
- self.driver.execute_script("window.scrollBy(0, 1000);")
283
- time.sleep(random.uniform(2, 4))
284
-
285
- # Find video links
286
- video_links = self.driver.find_elements(By.XPATH, '//a[@href and contains(@href, "/video/")]')
287
- video_links = list({link.get_attribute('href') for link in video_links}) # Remove duplicates
288
-
289
- logging.info(f"Found {len(video_links)} videos for #{hashtag}.")
290
-
291
- for video_url in video_links[:max_comments_per_hashtag]:
292
- if video_url in self.commented_videos:
293
- logging.info(f"Already commented on {video_url}. Skipping...")
294
- continue
295
-
296
- try:
297
- self.driver.get(video_url)
298
- time.sleep(random.uniform(5, 7)) # Allow video page to load
299
-
300
- self.close_popups()
301
-
302
- # Wait for comment box
303
- comment_box = WebDriverWait(self.driver, 15).until(
304
- EC.presence_of_element_located((By.XPATH, '//div[@contenteditable="true"]'))
305
- )
306
-
307
- # Scroll to the comment box to ensure it's in view
308
- self.driver.execute_script("arguments[0].scrollIntoView({behavior: 'smooth', block: 'center'});", comment_box)
309
- time.sleep(random.uniform(1, 2))
310
-
311
- # Attempt to click the comment box
312
- if not self.click_element(comment_box):
313
- logging.error(f"Failed to click on comment box for {video_url}. Skipping...")
314
- self.capture_screenshot("click_failed")
315
- continue
316
-
317
- # Select a random comment and remove emojis
318
- original_comment = random.choice(self.comments)
319
- comment = remove_emojis(original_comment)
320
- logging.info(f"Selected comment: {comment}")
321
-
322
- # Enter comment character by character
323
- for char in comment:
324
- comment_box.send_keys(char)
325
- time.sleep(random.uniform(0.03, 0.07)) # Human-like typing speed
326
-
327
- # Submit the comment
328
- comment_box.send_keys(Keys.ENTER)
329
- logging.info(f"Posted comment on {video_url}")
330
- self.commented_videos.add(video_url)
331
- self.save_commented_videos()
332
- time.sleep(random.uniform(2, 5)) # Random delay between comments
333
-
334
- except TimeoutException:
335
- logging.error(f"Timeout while trying to comment on {video_url}.")
336
- self.capture_screenshot("timeout_error")
337
- continue
338
- except ElementClickInterceptedException:
339
- logging.error(f"Element click intercepted while trying to comment on {video_url}.")
340
- self.capture_screenshot("click_intercepted_error")
341
- continue
342
- except Exception as e:
343
- logging.error(f"Failed to comment on {video_url}: {e}")
344
- self.capture_screenshot("general_error")
345
- continue
346
-
347
- time.sleep(random.uniform(10, 15))
348
 
349
  def capture_screenshot(self, error_type):
350
  """Captures a screenshot of the current browser window."""
@@ -356,83 +251,18 @@ class TikTokBot:
356
  except Exception as e:
357
  logging.error(f"Failed to capture screenshot: {e}")
358
 
359
- def follow_users_in_comments(self, max_follows=5):
360
- """Placeholder for potential future functionality to follow users."""
361
- pass
362
 
363
- def parse_arguments():
364
- """Parses command-line arguments."""
365
- parser = argparse.ArgumentParser(description='TikTok Comment Bot Configuration')
366
- parser.add_argument('--hashtags', type=str, help='Path to custom hashtags file (one hashtag per line). If not provided, default hashtags will be used.')
367
- parser.add_argument('--comments', type=int, default=3, help='Number of comments per hashtag (default: 3)')
368
- return parser.parse_args()
369
 
370
  def main():
371
  # -------------------- Configuration -------------------- #
372
- args = parse_arguments()
373
-
374
  EMAIL = "foudmohammed914@gmail.com" # Replace with your TikTok email
375
  PASSWORD = "009988Ppooii@@@@" # Replace with your TikTok password
376
  COOKIES_FILE = 'tiktok_cookies.json'
377
  COMMENTED_FILE = 'commented_videos.json'
378
 
379
- # Change to your own hashtags here for what your target group is
380
- DEFAULT_HASHTAGS = [
381
- 'tech', 'security', 'github', 'projects',
382
- 'cybersecurity', 'coding', 'programming', 'developers',
383
- 'infosec', 'hacking', 'technews', 'technology',
384
- 'devops', 'machinelearning', 'ai', 'artificialintelligence',
385
- 'data', 'datascience', 'python', 'javascript',
386
- 'software', 'opensource', 'ethicalhacking', 'networksecurity',
387
- 'informationsecurity', 'pentesting', 'malware', 'cryptography',
388
- 'itsecurity', 'securitytips', 'cyberthreats', 'firewalls',
389
- 'cloudsecurity', 'dataprotection', 'ransomware', 'vulnerability',
390
- 'securityawareness', 'securitybreach', 'securityresearch', 'incidentresponse'
391
- ]
392
-
393
- # Load hashtags from file or use default
394
- if args.hashtags:
395
- if os.path.exists(args.hashtags):
396
- try:
397
- with open(args.hashtags, 'r', encoding='utf-8') as file:
398
- HASHTAGS = [line.strip().lstrip('#') for line in file if line.strip()]
399
- logging.info(f"Loaded {len(HASHTAGS)} hashtags from {args.hashtags}.")
400
- except Exception as e:
401
- logging.error(f"Failed to load hashtags from {args.hashtags}: {e}")
402
- HASHTAGS = DEFAULT_HASHTAGS
403
- logging.info("Falling back to default hashtags.")
404
- else:
405
- logging.error(f"Hashtags file {args.hashtags} does not exist. Using default hashtags.")
406
- HASHTAGS = DEFAULT_HASHTAGS
407
- else:
408
- HASHTAGS = DEFAULT_HASHTAGS
409
- logging.info("Using default hashtags.")
410
-
411
- # Comments list with GitHub reference
412
- COMMENTS = [
413
- "Love this! Check out my GitHub for cool projects: https://github.com/zebbern",
414
- "Interesting video! I share similar projects on GitHub: https://github.com/zebbern",
415
- "Great content! Feel free to explore my GitHub: https://github.com/zebbern",
416
- "Nice work! Visit my GitHub for more tech tools: https://github.com/zebbern",
417
- "Awesome! If you're into tech, check out my GitHub: https://github.com/zebbern",
418
- "Fantastic! I have related projects on GitHub: https://github.com/zebbern",
419
- "Great insights! Browse my GitHub repositories: https://github.com/zebbern",
420
- "Loved this! Explore my GitHub for more projects: https://github.com/zebbern",
421
- "Impressive! Check out my GitHub for similar tools: https://github.com/zebbern",
422
- "Excellent! Feel free to visit my GitHub: https://github.com/zebbern",
423
- "Nice video! I share security projects on GitHub: https://github.com/zebbern",
424
- "Great explanation! See my GitHub for related projects: https://github.com/zebbern",
425
- "Superb content! Explore my GitHub here: https://github.com/zebbern",
426
- "Loved your post! Visit my GitHub for tech tools: https://github.com/zebbern",
427
- "Excellent job! Check out my GitHub for more: https://github.com/zebbern",
428
- "Inspired by your video! Feel free to browse my GitHub: https://github.com/zebbern",
429
- "Great work! I have similar projects on GitHub: https://github.com/zebbern",
430
- "Awesome insights! Explore my GitHub projects: https://github.com/zebbern",
431
- "Fantastic video! Visit my GitHub for more tech content: https://github.com/zebbern",
432
- "Impressive! Check out my GitHub for tools: https://github.com/zebbern",
433
- ]
434
 
435
- MAX_COMMENTS_PER_HASHTAG = args.comments # Number of comments per hashtag
436
 
437
  # -------------------- End Configuration -------------------- #
438
 
@@ -452,7 +282,7 @@ def main():
452
 
453
  chrome_options = Options()
454
  chrome_options.add_argument("--start-maximized")
455
- chrome_options.add_argument("--headless") # Run in headless mode
456
  chrome_options.add_argument("--disable-blink-features=AutomationControlled") # Reduce bot detection
457
  chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
458
  chrome_options.add_experimental_option('useAutomationExtension', False)
@@ -475,8 +305,8 @@ def main():
475
  # -------------------- Initialize TikTokBot -------------------- #
476
  bot = TikTokBot(
477
  driver=driver,
478
- comments=COMMENTS,
479
- hashtags=HASHTAGS,
480
  login_email=EMAIL,
481
  login_password=PASSWORD,
482
  cookies_file=COOKIES_FILE,
 
52
  # -------------------- End Logging Configuration -------------------- #
53
 
54
  class TikTokBot:
55
+ def __init__(self, driver, login_email, login_password, cookies_file='tiktok_cookies.json', commented_file='commented_videos.json'):
56
  self.driver = driver
 
 
57
  self.login_email = login_email
58
  self.login_password = login_password
59
  self.cookies_file = cookies_file
60
  self.commented_file = commented_file
 
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  def save_cookies(self):
64
  """Saves cookies to a JSON file."""
 
128
 
129
  def login(self):
130
  """Logs into TikTok using cookies if available, otherwise performs manual login."""
131
+ self.driver.get("https://www.tiktok.com/login/phone-or-email/email")
132
  if self.load_cookies():
133
  self.driver.refresh()
134
  time.sleep(random.uniform(3, 6))
 
162
 
163
  # Wait for login to complete by checking URL change or presence of a user avatar
164
  WebDriverWait(self.driver, 30).until(
165
+ EC.url_changes("https://www.tiktok.com/login/phone-or-email/email")
166
  )
167
  time.sleep(random.uniform(3, 5)) # Allow time for the page to fully load
168
 
 
240
  self.capture_screenshot("general_error")
241
  return False
242
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
243
 
244
  def capture_screenshot(self, error_type):
245
  """Captures a screenshot of the current browser window."""
 
251
  except Exception as e:
252
  logging.error(f"Failed to capture screenshot: {e}")
253
 
 
 
 
254
 
255
+
 
 
 
 
 
256
 
257
  def main():
258
  # -------------------- Configuration -------------------- #
259
+
 
260
  EMAIL = "foudmohammed914@gmail.com" # Replace with your TikTok email
261
  PASSWORD = "009988Ppooii@@@@" # Replace with your TikTok password
262
  COOKIES_FILE = 'tiktok_cookies.json'
263
  COMMENTED_FILE = 'commented_videos.json'
264
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
265
 
 
266
 
267
  # -------------------- End Configuration -------------------- #
268
 
 
282
 
283
  chrome_options = Options()
284
  chrome_options.add_argument("--start-maximized")
285
+ # chrome_options.add_argument("--headless") # Run in headless mode
286
  chrome_options.add_argument("--disable-blink-features=AutomationControlled") # Reduce bot detection
287
  chrome_options.add_experimental_option("excludeSwitches", ["enable-automation"])
288
  chrome_options.add_experimental_option('useAutomationExtension', False)
 
305
  # -------------------- Initialize TikTokBot -------------------- #
306
  bot = TikTokBot(
307
  driver=driver,
308
+ # comments=COMMENTS,
309
+ # hashtags=HASHTAGS,
310
  login_email=EMAIL,
311
  login_password=PASSWORD,
312
  cookies_file=COOKIES_FILE,
tiktok_bot.log CHANGED
@@ -261,3 +261,379 @@ Stacktrace:
261
  2025-07-13 04:57:09,723 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x78e9b8941af0>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/a28af9af24222dc6b82ea6eca1d59f15
262
  2025-07-13 04:57:09,725 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x78e9b8279250>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/a28af9af24222dc6b82ea6eca1d59f15
263
  2025-07-13 04:57:09,728 - INFO - WebDriver closed successfully
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
261
  2025-07-13 04:57:09,723 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x78e9b8941af0>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/a28af9af24222dc6b82ea6eca1d59f15
262
  2025-07-13 04:57:09,725 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x78e9b8279250>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/a28af9af24222dc6b82ea6eca1d59f15
263
  2025-07-13 04:57:09,728 - INFO - WebDriver closed successfully
264
+ 2025-07-13 05:03:21,678 - INFO - Chrome WebDriver initialized successfully
265
+ 2025-07-13 05:03:21,678 - INFO - Loaded 2 previously commented videos.
266
+ 2025-07-13 05:03:22,457 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
267
+ 2025-07-13 05:03:22,894 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
268
+ 2025-07-13 05:03:22,898 - INFO - Application started
269
+ 2025-07-13 05:03:29,824 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
270
+ 2025-07-13 05:03:30,629 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/sendMessage "HTTP/1.1 200 OK"
271
+ 2025-07-13 05:03:32,473 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
272
+ 2025-07-13 05:03:32,732 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/sendMessage "HTTP/1.1 200 OK"
273
+ 2025-07-13 05:03:35,418 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
274
+ 2025-07-13 05:03:35,642 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/sendMessage "HTTP/1.1 200 OK"
275
+ 2025-07-13 05:03:35,920 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/editMessageText "HTTP/1.1 200 OK"
276
+ 2025-07-13 05:04:01,609 - INFO - Cookies loaded successfully.
277
+ 2025-07-13 05:04:33,280 - INFO - Logged in using cookies.
278
+ 2025-07-13 05:04:33,285 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
279
+ 2025-07-13 05:04:34,125 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/editMessageText "HTTP/1.1 200 OK"
280
+ 2025-07-13 05:04:34,126 - INFO - Attempting to post comment on: https://www.tiktok.com/@yemn61/video/7523966949387242782?is_from_webapp=1&sender_device=pc
281
+ 2025-07-13 05:04:55,032 - INFO - Clicked on element successfully.
282
+ 2025-07-13 05:04:55,033 - INFO - Posting comment: 234
283
+ 2025-07-13 05:04:55,588 - INFO - Successfully posted comment on https://www.tiktok.com/@yemn61/video/7523966949387242782?is_from_webapp=1&sender_device=pc
284
+ 2025-07-13 05:04:55,589 - INFO - Commented videos have been saved successfully.
285
+ 2025-07-13 05:04:59,984 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
286
+ 2025-07-13 05:05:01,356 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/editMessageText "HTTP/1.1 200 OK"
287
+ 2025-07-13 05:05:10,316 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
288
+ 2025-07-13 05:05:12,449 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x752711230ad0>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/c2bbad3407bbcca5cfcd760c183bde13
289
+ 2025-07-13 05:05:12,450 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7527110c2a20>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/c2bbad3407bbcca5cfcd760c183bde13
290
+ 2025-07-13 05:05:12,450 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7527110c3320>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/c2bbad3407bbcca5cfcd760c183bde13
291
+ 2025-07-13 05:05:12,451 - INFO - WebDriver closed successfully
292
+ 2025-07-13 05:07:20,200 - INFO - 🤖 Starting Telegram TikTok Bot in background thread...
293
+ 2025-07-13 05:07:20,201 - INFO - 📱 Bot is now running. Send /start to begin!
294
+ 2025-07-13 05:07:21,305 - INFO - Chrome WebDriver initialized successfully
295
+ 2025-07-13 05:07:21,306 - INFO - Loaded 3 previously commented videos.
296
+ 2025-07-13 05:07:21,535 - INFO - WebDriver closed successfully
297
+ 2025-07-13 05:07:21,535 - INFO - Bot thread finished
298
+ 2025-07-13 05:09:24,347 - INFO - Chrome WebDriver initialized successfully
299
+ 2025-07-13 05:09:24,349 - INFO - Loaded 3 previously commented videos.
300
+ 2025-07-13 05:09:24,524 - INFO - WebDriver closed successfully
301
+ 2025-07-13 05:11:03,704 - INFO - 🤖 Starting Telegram TikTok Bot in background thread...
302
+ 2025-07-13 05:11:03,704 - INFO - 📱 Bot is now running. Send /start to begin!
303
+ 2025-07-13 05:11:04,663 - INFO - Chrome WebDriver initialized successfully
304
+ 2025-07-13 05:11:04,663 - INFO - Loaded 3 previously commented videos.
305
+ 2025-07-13 05:11:04,834 - INFO - WebDriver closed successfully
306
+ 2025-07-13 05:11:04,834 - INFO - Bot thread finished
307
+ 2025-07-13 05:13:29,735 - INFO - Chrome WebDriver initialized successfully
308
+ 2025-07-13 05:13:29,738 - INFO - Loaded 3 previously commented videos.
309
+ 2025-07-13 05:13:30,712 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
310
+ 2025-07-13 05:13:30,926 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
311
+ 2025-07-13 05:13:30,927 - INFO - Application started
312
+ 2025-07-13 05:13:41,713 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
313
+ 2025-07-13 05:13:52,036 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
314
+ 2025-07-13 05:14:02,248 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
315
+ 2025-07-13 05:14:12,463 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
316
+ 2025-07-13 05:14:22,671 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
317
+ 2025-07-13 05:14:32,994 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
318
+ 2025-07-13 05:14:43,213 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
319
+ 2025-07-13 05:14:53,678 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
320
+ 2025-07-13 05:15:03,897 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getUpdates "HTTP/1.1 200 OK"
321
+ 2025-07-13 05:15:08,356 - WARNING - Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x701259492b10>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/91586f5dd98621b92102bb0867e04715
322
+ 2025-07-13 05:15:08,358 - WARNING - Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7012594fdfd0>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/91586f5dd98621b92102bb0867e04715
323
+ 2025-07-13 05:15:08,360 - WARNING - Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7012594fd0a0>: Failed to establish a new connection: [Errno 111] Connection refused')': /session/91586f5dd98621b92102bb0867e04715
324
+ 2025-07-13 05:15:08,362 - INFO - WebDriver closed successfully
325
+ 2025-07-13 05:15:11,905 - INFO - Chrome WebDriver initialized successfully
326
+ 2025-07-13 05:15:11,906 - INFO - Loaded 3 previously commented videos.
327
+ 2025-07-13 05:15:12,035 - INFO - WebDriver closed successfully
328
+ 2025-07-13 05:16:57,886 - INFO - Chrome WebDriver initialized successfully
329
+ 2025-07-13 05:16:57,887 - INFO - Loaded 3 previously commented videos.
330
+ 2025-07-13 05:16:58,255 - INFO - WebDriver closed successfully
331
+ 2025-07-13 05:18:01,873 - INFO - Chrome WebDriver initialized successfully
332
+ 2025-07-13 05:18:01,874 - INFO - Loaded 3 previously commented videos.
333
+ 2025-07-13 05:18:02,621 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
334
+ 2025-07-13 05:18:02,623 - INFO - Application started
335
+ 2025-07-13 05:18:03,112 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
336
+ 2025-07-13 05:18:03,254 - INFO - WebDriver closed successfully
337
+ 2025-07-13 05:18:51,686 - ERROR - Task was destroyed but it is pending!
338
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
339
+ 2025-07-13 05:18:51,686 - ERROR - Task was destroyed but it is pending!
340
+ task: <Task pending name='Updater:start_polling:polling_task' coro=<Updater._network_loop_retry() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:755> wait_for=<Future pending cb=[Task.task_wakeup()]>>
341
+ 2025-07-13 05:18:51,687 - ERROR - Task was destroyed but it is pending!
342
+ task: <Task pending name='Task-10' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:376>>
343
+ 2025-07-13 05:18:51,687 - ERROR - Task was destroyed but it is pending!
344
+ task: <Task pending name='Task-11' coro=<Event.wait() running at /usr/lib/python3.12/asyncio/locks.py:199>>
345
+ 2025-07-13 05:18:54,233 - INFO - Chrome WebDriver initialized successfully
346
+ 2025-07-13 05:18:54,233 - INFO - Loaded 3 previously commented videos.
347
+ 2025-07-13 05:18:54,363 - INFO - WebDriver closed successfully
348
+ 2025-07-13 05:19:09,191 - INFO - Chrome WebDriver initialized successfully
349
+ 2025-07-13 05:19:09,191 - INFO - Loaded 3 previously commented videos.
350
+ 2025-07-13 05:19:09,943 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
351
+ 2025-07-13 05:19:09,945 - INFO - Application started
352
+ 2025-07-13 05:19:10,142 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
353
+ 2025-07-13 05:19:10,270 - INFO - WebDriver closed successfully
354
+ 2025-07-13 05:19:48,543 - ERROR - Task was destroyed but it is pending!
355
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
356
+ 2025-07-13 05:19:48,544 - ERROR - Task was destroyed but it is pending!
357
+ task: <Task pending name='Updater:start_polling:polling_task' coro=<Updater._network_loop_retry() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:755> wait_for=<Future pending cb=[Task.task_wakeup()]>>
358
+ 2025-07-13 05:19:48,544 - ERROR - Task was destroyed but it is pending!
359
+ task: <Task pending name='Task-8' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:376>>
360
+ 2025-07-13 05:19:48,544 - ERROR - Task was destroyed but it is pending!
361
+ task: <Task pending name='Task-9' coro=<Event.wait() running at /usr/lib/python3.12/asyncio/locks.py:199>>
362
+ 2025-07-13 05:19:51,303 - INFO - Chrome WebDriver initialized successfully
363
+ 2025-07-13 05:19:51,304 - INFO - Loaded 3 previously commented videos.
364
+ 2025-07-13 05:19:52,058 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
365
+ 2025-07-13 05:19:52,060 - INFO - Application started
366
+ 2025-07-13 05:19:52,186 - INFO - WebDriver closed successfully
367
+ 2025-07-13 05:20:01,861 - ERROR - Task was destroyed but it is pending!
368
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
369
+ 2025-07-13 05:20:05,226 - INFO - 🤖 Starting Telegram TikTok Bot in background thread...
370
+ 2025-07-13 05:20:05,226 - INFO - 📱 Bot is now running. Send /start to begin!
371
+ 2025-07-13 05:20:09,998 - INFO - Chrome WebDriver initialized successfully
372
+ 2025-07-13 05:20:09,998 - INFO - Loaded 3 previously commented videos.
373
+ 2025-07-13 05:20:10,627 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
374
+ 2025-07-13 05:20:10,628 - INFO - Application started
375
+ 2025-07-13 05:20:10,904 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
376
+ 2025-07-13 05:20:11,044 - INFO - WebDriver closed successfully
377
+ 2025-07-13 05:21:12,364 - ERROR - Task was destroyed but it is pending!
378
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
379
+ 2025-07-13 05:21:12,365 - ERROR - Task was destroyed but it is pending!
380
+ task: <Task pending name='Updater:start_polling:polling_task' coro=<Updater._network_loop_retry() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:755> wait_for=<Future pending cb=[Task.task_wakeup()]>>
381
+ 2025-07-13 05:21:12,365 - ERROR - Task was destroyed but it is pending!
382
+ task: <Task pending name='Task-8' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:376>>
383
+ 2025-07-13 05:21:12,365 - ERROR - Task was destroyed but it is pending!
384
+ task: <Task pending name='Task-9' coro=<Event.wait() running at /usr/lib/python3.12/asyncio/locks.py:199>>
385
+ 2025-07-13 05:21:15,180 - INFO - Chrome WebDriver initialized successfully
386
+ 2025-07-13 05:21:15,181 - INFO - Loaded 3 previously commented videos.
387
+ 2025-07-13 05:21:15,973 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
388
+ 2025-07-13 05:21:15,974 - INFO - Application started
389
+ 2025-07-13 05:21:16,103 - INFO - WebDriver closed successfully
390
+ 2025-07-13 05:21:59,449 - ERROR - Task was destroyed but it is pending!
391
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
392
+ 2025-07-13 05:22:02,758 - INFO - Chrome WebDriver initialized successfully
393
+ 2025-07-13 05:22:02,759 - INFO - Loaded 3 previously commented videos.
394
+ 2025-07-13 05:22:03,744 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
395
+ 2025-07-13 05:22:03,746 - INFO - Application started
396
+ 2025-07-13 05:22:04,155 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
397
+ 2025-07-13 05:22:04,281 - INFO - WebDriver closed successfully
398
+ 2025-07-13 05:22:04,282 - ERROR - Task exception was never retrieved
399
+ future: <Task finished name='Task-10' coro=<Updater.start_polling() done, defined at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:214> exception=RuntimeError('This Updater is already running!')>
400
+ Traceback (most recent call last):
401
+ File "/home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py", line 315, in start_polling
402
+ raise RuntimeError("This Updater is already running!")
403
+ RuntimeError: This Updater is already running!
404
+ 2025-07-13 05:22:09,953 - ERROR - Task was destroyed but it is pending!
405
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
406
+ 2025-07-13 05:22:09,954 - ERROR - Task was destroyed but it is pending!
407
+ task: <Task pending name='Updater:start_polling:polling_task' coro=<Updater._network_loop_retry() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:755> wait_for=<Future pending cb=[Task.task_wakeup()]>>
408
+ 2025-07-13 05:22:09,954 - ERROR - Task was destroyed but it is pending!
409
+ task: <Task pending name='Task-11' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:376>>
410
+ 2025-07-13 05:22:09,954 - ERROR - Task was destroyed but it is pending!
411
+ task: <Task pending name='Task-12' coro=<Event.wait() running at /usr/lib/python3.12/asyncio/locks.py:199>>
412
+ 2025-07-13 05:22:12,776 - INFO - Chrome WebDriver initialized successfully
413
+ 2025-07-13 05:22:12,776 - INFO - Loaded 3 previously commented videos.
414
+ 2025-07-13 05:22:13,538 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
415
+ 2025-07-13 05:22:13,539 - INFO - Application started
416
+ 2025-07-13 05:22:13,651 - INFO - WebDriver closed successfully
417
+ 2025-07-13 05:23:06,661 - INFO - Chrome WebDriver initialized successfully
418
+ 2025-07-13 05:23:06,662 - INFO - Loaded 3 previously commented videos.
419
+ 2025-07-13 05:23:07,415 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/getMe "HTTP/1.1 200 OK"
420
+ 2025-07-13 05:23:07,417 - INFO - Application started
421
+ 2025-07-13 05:23:07,707 - INFO - HTTP Request: POST https://api.telegram.org/bot7644815858:AAE-UvLYwbfTjIFGdCHUwouYkJ7dcDOrXm4/deleteWebhook "HTTP/1.1 200 OK"
422
+ 2025-07-13 05:23:07,856 - INFO - WebDriver closed successfully
423
+ 2025-07-13 05:24:25,885 - ERROR - Task was destroyed but it is pending!
424
+ task: <Task pending name='Application:7644815858:update_fetcher' coro=<Application._update_fetcher() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_application.py:1248> wait_for=<Future pending cb=[Task.task_wakeup()]>>
425
+ 2025-07-13 05:24:25,885 - ERROR - Task was destroyed but it is pending!
426
+ task: <Task pending name='Updater:start_polling:polling_task' coro=<Updater._network_loop_retry() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:755> wait_for=<Future pending cb=[Task.task_wakeup()]>>
427
+ 2025-07-13 05:24:25,885 - ERROR - Task was destroyed but it is pending!
428
+ task: <Task pending name='Task-8' coro=<Updater._start_polling.<locals>.polling_action_cb() running at /home/mfoud444/.local/lib/python3.12/site-packages/telegram/ext/_updater.py:376>>
429
+ 2025-07-13 05:24:25,886 - ERROR - Task was destroyed but it is pending!
430
+ task: <Task pending name='Task-9' coro=<Event.wait() running at /usr/lib/python3.12/asyncio/locks.py:199>>
431
+ 2025-07-13 05:39:51,225 - INFO - Using default hashtags.
432
+ 2025-07-13 05:39:52,517 - INFO - Initialized Chrome WebDriver successfully.
433
+ 2025-07-13 05:39:52,518 - INFO - Loaded 3 previously commented videos.
434
+ 2025-07-13 05:39:52,873 - ERROR - An unexpected error occurred: Message: unknown error: net::ERR_INTERNET_DISCONNECTED
435
+ (Session info: chrome=131.0.6778.204)
436
+ Stacktrace:
437
+ #0 0x6125d4c911fa <unknown>
438
+ #1 0x6125d47a1810 <unknown>
439
+ #2 0x6125d4799a24 <unknown>
440
+ #3 0x6125d4789db9 <unknown>
441
+ #4 0x6125d478bac4 <unknown>
442
+ #5 0x6125d478a06d <unknown>
443
+ #6 0x6125d47898cf <unknown>
444
+ #7 0x6125d47897c2 <unknown>
445
+ #8 0x6125d47877e6 <unknown>
446
+ #9 0x6125d4787e5a <unknown>
447
+ #10 0x6125d47a4139 <unknown>
448
+ #11 0x6125d4833c55 <unknown>
449
+ #12 0x6125d4814582 <unknown>
450
+ #13 0x6125d4833007 <unknown>
451
+ #14 0x6125d4814323 <unknown>
452
+ #15 0x6125d47e2de0 <unknown>
453
+ #16 0x6125d47e3dbe <unknown>
454
+ #17 0x6125d4c5d12b <unknown>
455
+ #18 0x6125d4c610c7 <unknown>
456
+ #19 0x6125d4c4a6cc <unknown>
457
+ #20 0x6125d4c61c47 <unknown>
458
+ #21 0x6125d4c2f67f <unknown>
459
+ #22 0x6125d4c80288 <unknown>
460
+ #23 0x6125d4c80450 <unknown>
461
+ #24 0x6125d4c90076 <unknown>
462
+ #25 0x7ff7e229caa4 <unknown>
463
+ #26 0x7ff7e2329c3c <unknown>
464
+
465
+ 2025-07-13 05:39:52,873 - INFO - Bot execution finished. Closing browser in 10 seconds.
466
+ 2025-07-14 00:25:22,910 - INFO - Using default hashtags.
467
+ 2025-07-14 00:25:28,003 - WARNING - There was an error managing chromedriver (error sending request for url (https://googlechromelabs.github.io/chrome-for-testing/known-good-versions-with-downloads.json)); using driver found in the cache
468
+ 2025-07-14 00:25:28,006 - WARNING - Error sending stats to Plausible: error sending request for url (https://plausible.io/api/event)
469
+ 2025-07-14 00:25:29,157 - INFO - Initialized Chrome WebDriver successfully.
470
+ 2025-07-14 00:25:29,158 - INFO - Loaded 3 previously commented videos.
471
+ 2025-07-14 00:25:57,098 - INFO - Cookies loaded successfully.
472
+ 2025-07-14 00:26:05,957 - WARNING - Cookies expired or invalid. Proceeding with manual login.
473
+ 2025-07-14 00:26:26,459 - ERROR - An error occurred during login: Message:
474
+ Stacktrace:
475
+ #0 0x5dc9b82831fa <unknown>
476
+ #1 0x5dc9b7d93810 <unknown>
477
+ #2 0x5dc9b7de2506 <unknown>
478
+ #3 0x5dc9b7de27a1 <unknown>
479
+ #4 0x5dc9b7e27c24 <unknown>
480
+ #5 0x5dc9b7e065ad <unknown>
481
+ #6 0x5dc9b7e25007 <unknown>
482
+ #7 0x5dc9b7e06323 <unknown>
483
+ #8 0x5dc9b7dd4de0 <unknown>
484
+ #9 0x5dc9b7dd5dbe <unknown>
485
+ #10 0x5dc9b824f12b <unknown>
486
+ #11 0x5dc9b82530c7 <unknown>
487
+ #12 0x5dc9b823c6cc <unknown>
488
+ #13 0x5dc9b8253c47 <unknown>
489
+ #14 0x5dc9b822167f <unknown>
490
+ #15 0x5dc9b8272288 <unknown>
491
+ #16 0x5dc9b8272450 <unknown>
492
+ #17 0x5dc9b8282076 <unknown>
493
+ #18 0x7bf10f09caa4 <unknown>
494
+ #19 0x7bf10f129c3c <unknown>
495
+
496
+ 2025-07-14 00:26:46,220 - INFO - Bot execution finished. Closing browser in 10 seconds.
497
+ 2025-07-14 00:26:49,092 - INFO - Using default hashtags.
498
+ 2025-07-14 00:26:59,785 - INFO - Initialized Chrome WebDriver successfully.
499
+ 2025-07-14 00:26:59,787 - INFO - Loaded 3 previously commented videos.
500
+ 2025-07-14 00:28:59,889 - ERROR - An unexpected error occurred: HTTPConnectionPool(host='localhost', port=57493): Read timed out. (read timeout=120)
501
+ 2025-07-14 00:28:59,890 - INFO - Bot execution finished. Closing browser in 10 seconds.
502
+ 2025-07-14 00:29:32,888 - INFO - Using default hashtags.
503
+ 2025-07-14 00:29:34,010 - INFO - Initialized Chrome WebDriver successfully.
504
+ 2025-07-14 00:29:34,011 - INFO - Loaded 3 previously commented videos.
505
+ 2025-07-14 00:30:54,204 - INFO - Cookies loaded successfully.
506
+ 2025-07-14 00:31:46,910 - WARNING - Cookies expired or invalid. Proceeding with manual login.
507
+ 2025-07-14 00:32:07,204 - ERROR - An error occurred during login: Message:
508
+ Stacktrace:
509
+ #0 0x60591c3ab1fa <unknown>
510
+ #1 0x60591bebb810 <unknown>
511
+ #2 0x60591bf0a506 <unknown>
512
+ #3 0x60591bf0a7a1 <unknown>
513
+ #4 0x60591bf4fc24 <unknown>
514
+ #5 0x60591bf2e5ad <unknown>
515
+ #6 0x60591bf4d007 <unknown>
516
+ #7 0x60591bf2e323 <unknown>
517
+ #8 0x60591befcde0 <unknown>
518
+ #9 0x60591befddbe <unknown>
519
+ #10 0x60591c37712b <unknown>
520
+ #11 0x60591c37b0c7 <unknown>
521
+ #12 0x60591c3646cc <unknown>
522
+ #13 0x60591c37bc47 <unknown>
523
+ #14 0x60591c34967f <unknown>
524
+ #15 0x60591c39a288 <unknown>
525
+ #16 0x60591c39a450 <unknown>
526
+ #17 0x60591c3aa076 <unknown>
527
+ #18 0x787a8589caa4 <unknown>
528
+ #19 0x787a85929c3c <unknown>
529
+
530
+ 2025-07-14 00:36:03,978 - INFO - Bot execution finished. Closing browser in 10 seconds.
531
+ 2025-07-14 00:36:06,756 - INFO - Using default hashtags.
532
+ 2025-07-14 00:36:07,969 - INFO - Initialized Chrome WebDriver successfully.
533
+ 2025-07-14 00:36:07,971 - INFO - Loaded 3 previously commented videos.
534
+ 2025-07-14 00:36:38,139 - INFO - Bot execution finished. Closing browser in 10 seconds.
535
+ 2025-07-14 00:36:41,710 - INFO - Initialized Chrome WebDriver successfully.
536
+ 2025-07-14 00:37:03,086 - INFO - Using default hashtags.
537
+ 2025-07-14 00:37:04,349 - INFO - Initialized Chrome WebDriver successfully.
538
+ 2025-07-14 00:37:04,354 - INFO - Loaded 3 previously commented videos.
539
+ 2025-07-14 00:38:43,416 - INFO - Cookies loaded successfully.
540
+ 2025-07-14 00:39:28,336 - INFO - Bot execution finished. Closing browser in 10 seconds.
541
+ 2025-07-14 00:39:32,019 - INFO - Initialized Chrome WebDriver successfully.
542
+ 2025-07-14 00:39:32,020 - INFO - Loaded 3 previously commented videos.
543
+ 2025-07-14 00:41:06,870 - INFO - Cookies loaded successfully.
544
+ 2025-07-14 00:42:21,074 - WARNING - Cookies expired or invalid. Proceeding with manual login.
545
+ 2025-07-14 00:42:41,454 - ERROR - An error occurred during login: Message:
546
+ Stacktrace:
547
+ #0 0x55af862c01fa <unknown>
548
+ #1 0x55af85dd0810 <unknown>
549
+ #2 0x55af85e1f506 <unknown>
550
+ #3 0x55af85e1f7a1 <unknown>
551
+ #4 0x55af85e64c24 <unknown>
552
+ #5 0x55af85e435ad <unknown>
553
+ #6 0x55af85e62007 <unknown>
554
+ #7 0x55af85e43323 <unknown>
555
+ #8 0x55af85e11de0 <unknown>
556
+ #9 0x55af85e12dbe <unknown>
557
+ #10 0x55af8628c12b <unknown>
558
+ #11 0x55af862900c7 <unknown>
559
+ #12 0x55af862796cc <unknown>
560
+ #13 0x55af86290c47 <unknown>
561
+ #14 0x55af8625e67f <unknown>
562
+ #15 0x55af862af288 <unknown>
563
+ #16 0x55af862af450 <unknown>
564
+ #17 0x55af862bf076 <unknown>
565
+ #18 0x747ae609caa4 <unknown>
566
+ #19 0x747ae6129c3c <unknown>
567
+
568
+ 2025-07-14 00:51:05,069 - INFO - Bot execution finished. Closing browser in 10 seconds.
569
+ 2025-07-14 00:51:12,978 - INFO - Created custom Selenium cache directory at: /home/mfoud444/1project/opensource/tik/selenium_cache
570
+ 2025-07-14 00:51:14,101 - INFO - Initialized Chrome WebDriver successfully.
571
+ 2025-07-14 00:52:24,616 - INFO - Cookies loaded successfully.
572
+ 2025-07-14 00:52:33,443 - WARNING - Cookies expired or invalid. Proceeding with manual login.
573
+ 2025-07-14 00:52:45,927 - INFO - Bot execution finished. Closing browser in 10 seconds.
574
+ 2025-07-14 00:52:52,461 - INFO - Created custom Selenium cache directory at: /home/mfoud444/1project/opensource/tik/selenium_cache
575
+ 2025-07-14 00:52:53,672 - INFO - Initialized Chrome WebDriver successfully.
576
+ 2025-07-14 00:53:40,064 - ERROR - An unexpected error occurred: Message: unknown error: net::ERR_NAME_NOT_RESOLVED
577
+ (Session info: chrome=131.0.6778.204)
578
+ Stacktrace:
579
+ #0 0x5b6f4e7241fa <unknown>
580
+ #1 0x5b6f4e234810 <unknown>
581
+ #2 0x5b6f4e22ca24 <unknown>
582
+ #3 0x5b6f4e21cdb9 <unknown>
583
+ #4 0x5b6f4e21eac4 <unknown>
584
+ #5 0x5b6f4e21d06d <unknown>
585
+ #6 0x5b6f4e21c8cf <unknown>
586
+ #7 0x5b6f4e21c7c2 <unknown>
587
+ #8 0x5b6f4e21a7e6 <unknown>
588
+ #9 0x5b6f4e21ae5a <unknown>
589
+ #10 0x5b6f4e237139 <unknown>
590
+ #11 0x5b6f4e2c6c55 <unknown>
591
+ #12 0x5b6f4e2a7582 <unknown>
592
+ #13 0x5b6f4e2c6007 <unknown>
593
+ #14 0x5b6f4e2a7323 <unknown>
594
+ #15 0x5b6f4e275de0 <unknown>
595
+ #16 0x5b6f4e276dbe <unknown>
596
+ #17 0x5b6f4e6f012b <unknown>
597
+ #18 0x5b6f4e6f40c7 <unknown>
598
+ #19 0x5b6f4e6dd6cc <unknown>
599
+ #20 0x5b6f4e6f4c47 <unknown>
600
+ #21 0x5b6f4e6c267f <unknown>
601
+ #22 0x5b6f4e713288 <unknown>
602
+ #23 0x5b6f4e713450 <unknown>
603
+ #24 0x5b6f4e723076 <unknown>
604
+ #25 0x70abc2c9caa4 <unknown>
605
+ #26 0x70abc2d29c3c <unknown>
606
+
607
+ 2025-07-14 00:53:40,064 - INFO - Bot execution finished. Closing browser in 10 seconds.
608
+ 2025-07-14 00:54:10,358 - INFO - Initialized Chrome WebDriver successfully.
609
+ 2025-07-14 00:55:37,475 - INFO - No cookies file found.
610
+ 2025-07-14 00:55:37,475 - INFO - No cookies found. Proceeding with manual login.
611
+ 2025-07-14 00:55:40,632 - INFO - Bot execution finished. Closing browser in 10 seconds.
612
+ 2025-07-14 00:55:43,706 - INFO - Initialized Chrome WebDriver successfully.
613
+ 2025-07-14 00:56:19,711 - INFO - Bot execution finished. Closing browser in 10 seconds.
614
+ 2025-07-14 00:56:23,387 - INFO - Initialized Chrome WebDriver successfully.
615
+ 2025-07-14 00:56:30,286 - INFO - No cookies file found.
616
+ 2025-07-14 00:56:30,286 - INFO - No cookies found. Proceeding with manual login.
617
+ 2025-07-14 00:56:50,321 - ERROR - An error occurred during login: Message:
618
+ Stacktrace:
619
+ #0 0x5df6ecd371fa <unknown>
620
+ #1 0x5df6ec847810 <unknown>
621
+ #2 0x5df6ec896506 <unknown>
622
+ #3 0x5df6ec8967a1 <unknown>
623
+ #4 0x5df6ec8dbc24 <unknown>
624
+ #5 0x5df6ec8ba5ad <unknown>
625
+ #6 0x5df6ec8d9007 <unknown>
626
+ #7 0x5df6ec8ba323 <unknown>
627
+ #8 0x5df6ec888de0 <unknown>
628
+ #9 0x5df6ec889dbe <unknown>
629
+ #10 0x5df6ecd0312b <unknown>
630
+ #11 0x5df6ecd070c7 <unknown>
631
+ #12 0x5df6eccf06cc <unknown>
632
+ #13 0x5df6ecd07c47 <unknown>
633
+ #14 0x5df6eccd567f <unknown>
634
+ #15 0x5df6ecd26288 <unknown>
635
+ #16 0x5df6ecd26450 <unknown>
636
+ #17 0x5df6ecd36076 <unknown>
637
+ #18 0x74947ca9caa4 <unknown>
638
+ #19 0x74947cb29c3c <unknown>
639
+
tiktok_cookies.json DELETED
@@ -1 +0,0 @@
1
- [{"domain": "www.tiktok.com", "expiry": 1760143690, "httpOnly": false, "name": "msToken", "path": "/", "sameSite": "Lax", "secure": false, "value": "lJSX6JUOXko5XMefFDjsVlz5jCQfYJkFJwZNdomEaZ1HDNKr5t_2epmwN5EGS_Vtoy2nzjp6qtx81fUPIqP4AOh8Uu4dT_Pd2Xmir0nHronJecTnqWT4aRnVoQszoLVO1CVRi3eU2npTPQ=="}, {"domain": ".tiktok.com", "expiry": 1783903674, "httpOnly": true, "name": "odin_tt", "path": "/", "sameSite": "Lax", "secure": false, "value": "c762956616da3131f9a4759f15ab6578929ff255b27f7b487ffcb4a9d076f0051781c9df752bf965a41118438a528ac46d0ab5caecb8a3775028e46ecca21d10e4e399f843127c5ace7272e617de7a53"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "ssid_ucp_v1", "path": "/", "sameSite": "None", "secure": true, "value": "1.0.0-KGM0MDk3MTE4N2RkZTUxMTkwYzg3ZmIyYTZkZGNjOTc0MTRhZTBiZTcKGgiSiLr0rrK2uWgQuYTMwwYYsws4AUDqB0gEEAMaAm15IiA3OWM0YTRiNTcxYzEyZDgzMGY5YzQzY2RmMGI1MDAzYQ"}, {"domain": ".tiktok.com", "expiry": 1783903673, "httpOnly": true, "name": "ttwid", "path": "/", "sameSite": "None", "secure": true, "value": "1%7CLTnrghefO6bjNL2-FSkbpDulkeK6qOdbOxSfMbV8AXo%7C1752367673%7C4c7ab7dce34075709939a8cf0f76cbfbf3b02a8149ae4e5a6fca4b494086dfbe"}, {"domain": ".www.tiktok.com", "expiry": 1752799672, "httpOnly": false, "name": "perf_feed_cache", "path": "/", "sameSite": "Lax", "secure": true, "value": "{%22expireTimestamp%22:1752537600000%2C%22itemIds%22:[%227524063960799120656%22%2C%227523022750907256095%22%2C%227523856715754818823%22]}"}, {"domain": ".tiktok.com", "expiry": 1757551562, "httpOnly": false, "name": "passport_csrf_token", "path": "/", "sameSite": "None", "secure": true, "value": "72584f393d4ad06c7d4755b86b3f2e99"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "tt-target-idc", "path": "/", "sameSite": "Lax", "secure": false, "value": "alisg"}, {"domain": ".tiktok.com", "expiry": 1767919643, "httpOnly": true, "name": "tt_chain_token", "path": "/", "sameSite": "Lax", "secure": true, "value": "6YuKt/ySLjbEj4im/V/VzQ=="}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "store-country-sign", "path": "/", "sameSite": "Lax", "secure": false, "value": "MEIEDCUikW9zYc_KMRhfmQQgW858rvTu4EQ1TBntnhYSl_0tJfIg8ZCvp8lF0iS5kXMEEHQ-igu1kDj8K98Y_4QJB_4"}, {"domain": ".tiktok.com", "expiry": 1783903640, "httpOnly": true, "name": "tt-target-idc-sign", "path": "/", "sameSite": "Lax", "secure": false, "value": "LERx_eMAcqT-vp3sDdeiqf9lzs8mgAp6pil8jkCzLH9glu_sHq49u0-CCHa7Nf8XJnbLMUc7Cn4t4XepFSaLMzSNmq9t3saP38kxygUk-O8JYyfOCju0EJGIHCh3jpU1lpU_7Uc11ZladTyvkXdDUsj2YlvZHvlsg8fB4GWzwTB_0cE5w_lzjdVURRE1FAzppyUgm-lilpp6oAY-hUhKZUs4jLeDHXtPdPxvjx4peJ14dD9ADiFjQn0zllTaT0lmPS6-LPvpniJ6uWhzixp5qWrGAlHag5Rs7ju22VvhMwjBoKV71Q3sBPRqMAiM57gZVVbN1ysucMmaoer4A3dB3ukGDyKtudixDDQjZsUEEIBFQf_yC2dS9MP52_Za50n-BHXvaSPtA5sdZ4WS2TkX3il3MGF2mOCwy6KyCXQD8wEbQLnJcq2mCtyAhGF70wKpaE2-ntedocsEstZwVRqFRV19W0TSmtsusNmp8cqljiagXxgq1DnzGp8pso9CydUj"}, {"domain": ".tiktok.com", "httpOnly": true, "name": "tt_csrf_token", "path": "/", "sameSite": "Lax", "secure": true, "value": "Pehmv5Td-ZPF38gFQI8XoNgJjufjmtS0PX1U"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "store-country-code-src", "path": "/", "sameSite": "Lax", "secure": false, "value": "uid"}, {"domain": ".tiktok.com", "expiry": 1757551640, "httpOnly": true, "name": "cmpl_token", "path": "/", "sameSite": "Lax", "secure": true, "value": "AgQQAPOKF-RO0rhMNzVmvF0r8hKYlskXv4cBYN4-mw"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "store-idc", "path": "/", "sameSite": "Lax", "secure": false, "value": "alisg"}, {"domain": ".tiktok.com", "expiry": 1783471673, "httpOnly": true, "name": "sid_guard", "path": "/", "sameSite": "Lax", "secure": true, "value": "79c4a4b571c12d830f9c43cdf0b5003a%7C1752367673%7C15551967%7CFri%2C+09-Jan-2026+00%3A47%3A20+GMT"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "store-country-code", "path": "/", "sameSite": "Lax", "secure": false, "value": "ye"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "sessionid_ss", "path": "/", "sameSite": "None", "secure": true, "value": "79c4a4b571c12d830f9c43cdf0b5003a"}, {"domain": ".www.tiktok.com", "expiry": 1778287649, "httpOnly": false, "name": "tiktok_webapp_theme", "path": "/", "sameSite": "Lax", "secure": true, "value": "dark"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "sessionid", "path": "/", "sameSite": "Lax", "secure": true, "value": "79c4a4b571c12d830f9c43cdf0b5003a"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "uid_tt", "path": "/", "sameSite": "Lax", "secure": true, "value": "dc125c0dc59a8296af59d73fbad6a2cc3ef3073cdec21836c3bb6241210287cd"}, {"domain": ".www.tiktok.com", "expiry": 1778287672, "httpOnly": false, "name": "delay_guest_mode_vid", "path": "/", "sameSite": "Lax", "secure": true, "value": "5"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "uid_tt_ss", "path": "/", "sameSite": "None", "secure": true, "value": "dc125c0dc59a8296af59d73fbad6a2cc3ef3073cdec21836c3bb6241210287cd"}, {"domain": ".tiktok.com", "httpOnly": false, "name": "s_v_web_id", "path": "/", "sameSite": "None", "secure": true, "value": "verify_md0yf13h_ejbTvHsq_6xUY_4YKq_9tw6_zw6LREzGUUQQ"}, {"domain": "www.tiktok.com", "expiry": 1760143640, "httpOnly": false, "name": "last_login_method", "path": "/", "sameSite": "Lax", "secure": false, "value": "email"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "sid_ucp_v1", "path": "/", "sameSite": "Lax", "secure": true, "value": "1.0.0-KGM0MDk3MTE4N2RkZTUxMTkwYzg3ZmIyYTZkZGNjOTc0MTRhZTBiZTcKGgiSiLr0rrK2uWgQuYTMwwYYsws4AUDqB0gEEAMaAm15IiA3OWM0YTRiNTcxYzEyZDgzMGY5YzQzY2RmMGI1MDAzYQ"}, {"domain": ".tiktok.com", "expiry": 1783903640, "httpOnly": true, "name": "d_ticket", "path": "/", "sameSite": "Lax", "secure": false, "value": "6852a73631aabb13f1ee4e4038d5f3aa4d301"}, {"domain": ".tiktok.com", "expiry": 1753231702, "httpOnly": false, "name": "msToken", "path": "/", "sameSite": "None", "secure": true, "value": "0djZsjGxb6DFlEYoOh2TT_vKvc6UXBNj1KPNMmNjmf6vxh_1lYDgMArfR0zyvKFgN6PgcPr11M6K8EnAGOX7Jg30SvuXzqtuYTUNyypH-hhnE32eoK-2XmfYsmdOgo5aPfhOssXypN0-lw=="}, {"domain": ".www.tiktok.com", "httpOnly": false, "name": "passport_fe_beating_status", "path": "/", "sameSite": "Lax", "secure": false, "value": "true"}, {"domain": ".tiktok.com", "expiry": 1757551562, "httpOnly": false, "name": "passport_csrf_token_default", "path": "/", "sameSite": "Lax", "secure": true, "value": "72584f393d4ad06c7d4755b86b3f2e99"}, {"domain": ".www.tiktok.com", "expiry": 1778287649, "httpOnly": false, "name": "tiktok_webapp_theme_source", "path": "/", "sameSite": "Lax", "secure": true, "value": "auto"}, {"domain": ".tiktok.com", "expiry": 1757551640, "httpOnly": true, "name": "multi_sids", "path": "/", "sameSite": "Lax", "secure": true, "value": "7526317152380290066%3A79c4a4b571c12d830f9c43cdf0b5003a"}, {"domain": ".tiktok.com", "expiry": 1767919640, "httpOnly": true, "name": "sid_tt", "path": "/", "sameSite": "Lax", "secure": true, "value": "79c4a4b571c12d830f9c43cdf0b5003a"}]