You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When scraping for video data with TikTokApi, it shows 'object has no attribute 'num_sessions' in my log display area on the program panel. In cmd, no error reported
#code#
import tkinter as tk
from tkinter import scrolledtext
from tkinter import messagebox
import pandas as pd
from TikTokApi import TikTokApi
import asyncio
Initialize TikTok API
try:
api = TikTokApi() # Initialize API without additional parameters
except Exception as e:
print(f"Failed to initialize TikTokApi: {str(e)}")
exit(1)
Asynchronous function to fetch video data and update Excel
When scraping for video data with TikTokApi, it shows 'object has no attribute 'num_sessions' in my log display area on the program panel. In cmd, no error reported
#code#
import tkinter as tk
from tkinter import scrolledtext
from tkinter import messagebox
import pandas as pd
from TikTokApi import TikTokApi
import asyncio
Initialize TikTok API
try:
api = TikTokApi() # Initialize API without additional parameters
except Exception as e:
print(f"Failed to initialize TikTokApi: {str(e)}")
exit(1)
Asynchronous function to fetch video data and update Excel
async def fetch_video_data():
try:
# Load Excel file
df = pd.read_excel("VideoData.xlsx", engine='openpyxl')
Function to start asynchronous fetch
def start_fetch():
asyncio.run(fetch_video_data()) # Run the data fetch coroutine
GUI Setup
root = tk.Tk()
root.title("TikTok Video Data Fetcher")
Start Button
start_button = tk.Button(root, text="Start", command=start_fetch)
start_button.pack(pady=10)
Log Display Area
log_area = scrolledtext.ScrolledText(root, width=80, height=20)
log_area.pack(padx=10, pady=10)
Run the GUI event loop
root.mainloop()
Expected behavior: Video data scraped and saved to Excel
The text was updated successfully, but these errors were encountered: