wkaisertexas / tiktok-uploader

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

AttributeError: 'NoneType' object has no attribute 'authenticate_agent' #66

Closed mytricker0 closed 11 months ago

mytricker0 commented 11 months ago

got this error:

[22:46:35] Authenticating browser with cookies
[22:46:35] Create a firefox browser instance 
Traceback (most recent call last):
  File "/home/step/Desktop/ShortMaker/post.py", line 28, in <module>
    continuous_upload("output/")
  File "/home/step/Desktop/ShortMaker/post.py", line 21, in continuous_upload
    failled  = upload_videos(videos=video, cookies=COOKIES ,browser='firefox')
  File "/home/step/miniconda3/envs/ShortMaker/lib/python3.10/site-packages/tiktok_uploader/upload.py", line 114, in upload_videos
    driver = auth.authenticate_agent(driver)
AttributeError: 'NoneType' object has no attribute 'authenticate_agent'

when running this code:

from tiktok_uploader.upload import upload_videos
from tiktok_uploader.auth import AuthBackend
import os,time
tags = ["hisotry", "science", "fyp"]

COOKIES = "www.tiktok.com_cookies.txt"

auth = AuthBackend(cookies=COOKIES)

def continuous_upload(output_folder):
    #for every file in output folder
    for file in os.listdir(output_folder):
        #upload the file to tiktok
        title = file.split(".mp4")[0]

        video=[ { 'path': str(output_folder)+"/"+str(file), 'description': title+' #history #science #fyp'}]
        failled  = upload_videos(videos=video, cookies=COOKIES ,browser='firefox')
        print(failled)

        os.remove(file)
        #wait 1 hour
        time.sleep(60*5)

continuous_upload("output/")
misterneo commented 11 months ago

Try passing the auth variable to the upload_videos function instead of the cookies!

https://github.com/wkaisertexas/tiktok-uploader/tree/main#-uploading-videos