wkaisertexas / tiktok-uploader

Automatically ⬆️ upload TikTok videos
https://pypi.org/project/tiktok-uploader/
360 stars 84 forks source link

Fail to add cookie #65

Closed j-dbooth closed 11 months ago

j-dbooth commented 11 months ago

Current code

from tiktok_uploader.upload import upload_video

directory_path = "RedditVideoMakerBot\\results\\sample"
cookies_path = 'cookies.txt'  
cookies_list = [
    {
        'name': 'sessionid',
        'value': 'xxxxxxxxxxxxxxxxxxxx',
        'domain': 'www.tiktok.com',
        'path': '/',
        'expiry': '17/4/2024, 18:53:09 PM'
    }
]
video_files = [f for f in os.listdir(directory_path) if f.endswith('.mp4')]
for video_file in video_files:
    video_path = os.path.join(directory_path, video_file)
    description = format(video_file)
    print(description)
    print(video_path)
    print(cookies_path)
    upload_video(video_path, description=description, cookies_list=cookies_list, browser='firefox') # , headless=True

And heres the output

[20:39:17] Authenticating browser with cookies_list [20:39:17] Create a firefox browser instance [WDM] - Downloading: 17.8kB [00:00, ?B/s] [20:39:22] Authenticating browser with cookies [20:39:24] Failed to add cookie {'name': 'sessionid', 'value': 'xxxxxxxxxxxxxxxxxxxx', 'domain': 'www.tiktok.com', 'path': '/', 'expiry': '17/4/2024, 18:53:09 PM'} [20:39:24] Posting Sample.mp4 with description: Sample [20:39:24] Navigating to upload page

I replaced my sessionId with 'xxxxxxxxxxxxxxxxxxxx' to not expose it publicly but in actual use it does contain my proper sessionId value