wkaisertexas / tiktok-uploader

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

Stuck when trying to upload a video #25

Closed diegotrasobares closed 1 year ago

diegotrasobares commented 1 year ago

Hey!!! Trying to upload a single video. Everything works fine (authenticate and video upload) but then it gets stuck in the Upload screen. I wrote an example description but instead there is the file name. Then it just freeze there. Error I get after a few seconds of waiting: Message: no such element: Unable to locate element {"method":"xpath","selector":"//input[@type='file']"}

I guess this is the selector for the video upload but the video is already upload correctly. It freeze in the description,privacy options... My tiktok is in Spanish so it might be a problem with selectors?

diegotrasobares commented 1 year ago

I already fix it. It was because the lang of the page. I change the url from: https://www.tiktok.com/upload to https://www.tiktok.com/upload?lang=en and now everything working fine! The selectors are specific for english :)

JuniorDeveloperUA commented 1 year ago

@diegotrasobares hi, in my problem i have auto redirect from https://www.tiktok.com/upload?lang=en to https://www.tiktok.com/creator-center/upload?lang=en have you something like this ?

gqmv commented 1 year ago

I'm getting a similar issue Currently running the latest commit to the main branch. `Stacktrace: 0 chromedriver 0x0000000102c5bf48 chromedriver + 4226888 1 chromedriver 0x0000000102c544f4 chromedriver + 4195572 2 chromedriver 0x0000000102898d68 chromedriver + 281960 3 chromedriver 0x00000001028d3fc8 chromedriver + 524232 4 chromedriver 0x000000010290ac58 chromedriver + 748632 5 chromedriver 0x00000001028c7f1c chromedriver + 474908 6 chromedriver 0x00000001028c8ef4 chromedriver + 478964 7 chromedriver 0x0000000102c1d59c chromedriver + 3970460 8 chromedriver 0x0000000102c216f0 chromedriver + 3987184 9 chromedriver 0x0000000102c275b4 chromedriver + 4011444 10 chromedriver 0x0000000102c222fc chromedriver + 3990268 11 chromedriver 0x0000000102bfa1c0 chromedriver + 3826112 12 chromedriver 0x0000000102c3e088 chromedriver + 4104328 13 chromedriver 0x0000000102c3e1e0 chromedriver + 4104672 14 chromedriver 0x0000000102c4df28 chromedriver + 4169512 15 libsystem_pthread.dylib 0x000000018bd1a06c _pthread_start + 148 16 libsystem_pthread.dylib 0x000000018bd14e2c thread_start + 8

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@type='file']"} (Session info: chrome=114.0.5735.198); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: 0 chromedriver 0x0000000102c5bf48 chromedriver + 4226888 1 chromedriver 0x0000000102c544f4 chromedriver + 4195572 2 chromedriver 0x0000000102898d68 chromedriver + 281960 3 chromedriver 0x00000001028d3fc8 chromedriver + 524232 4 chromedriver 0x000000010290ac58 chromedriver + 748632 5 chromedriver 0x00000001028c7f1c chromedriver + 474908 6 chromedriver 0x00000001028c8ef4 chromedriver + 478964 7 chromedriver 0x0000000102c1d59c chromedriver + 3970460 8 chromedriver 0x0000000102c216f0 chromedriver + 3987184 9 chromedriver 0x0000000102c275b4 chromedriver + 4011444 10 chromedriver 0x0000000102c222fc chromedriver + 3990268 11 chromedriver 0x0000000102bfa1c0 chromedriver + 3826112 12 chromedriver 0x0000000102c3e088 chromedriver + 4104328 13 chromedriver 0x0000000102c3e1e0 chromedriver + 4104672 14 chromedriver 0x0000000102c4df28 chromedriver + 4169512 15 libsystem_pthread.dylib 0x000000018bd1a06c _pthread_start + 148 16 libsystem_pthread.dylib 0x000000018bd14e2c thread_start + 8

Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@type='file']"} (Session info: chrome=114.0.5735.198); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: 0 chromedriver 0x0000000102c5bf48 chromedriver + 4226888 1 chromedriver 0x0000000102c544f4 chromedriver + 4195572 2 chromedriver 0x0000000102898d68 chromedriver + 281960 3 chromedriver 0x00000001028d3fc8 chromedriver + 524232 4 chromedriver 0x000000010290ac58 chromedriver + 748632 5 chromedriver 0x00000001028c7f1c chromedriver + 474908 6 chromedriver 0x00000001028c8ef4 chromedriver + 478964 7 chromedriver 0x0000000102c1d59c chromedriver + 3970460 8 chromedriver 0x0000000102c216f0 chromedriver + 3987184 9 chromedriver 0x0000000102c275b4 chromedriver + 4011444 10 chromedriver 0x0000000102c222fc chromedriver + 3990268 11 chromedriver 0x0000000102bfa1c0 chromedriver + 3826112 12 chromedriver 0x0000000102c3e088 chromedriver + 4104328 13 chromedriver 0x0000000102c3e1e0 chromedriver + 4104672 14 chromedriver 0x0000000102c4df28 chromedriver + 4169512 15 libsystem_pthread.dylib 0x000000018bd1a06c _pthread_start + 148 16 libsystem_pthread.dylib 0x000000018bd14e2c thread_start + 8

[16:55:47] Failed to upload /Users/gabrielqueiroz/Dev/infinite-money-generator/output/I am a foot and a ha/pt-br.mp4 [16:55:47] A video failed to upload `

I have identified that the error is being caused by WebDriverWait(driver, config['implicit_wait']).until(upload_confirmation)

Not sure why tho. This isn't a language issue, since the latest commit theoretically fixes that. Anyways, any help is welcome :)

gqmv commented 1 year ago

I just opened PR #29 that should close this issue.

JuniorDeveloperUA commented 1 year ago

i fix my problem with essage: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@type='file']"} when https://www.tiktok.com/upload?lang=en redirect to https://www.tiktok.com/creator-center/upload?lang=en need to make new iframe and "input upload" xpath

gqmv commented 1 year ago

Yeah, that also seems to happen sometimes. The error message Unable to locate element: {"method":"xpath","selector":"//input[@type='file']"} can appear in multiple cases. In my case, it happened because a retry was triggered when it wasn't warranted. In yours, it's probably because the xpath is different in the creator center. One of my accounts is suffering from this issue, I'll try to fix it and open another pr

diegotrasobares commented 1 year ago

@JuniorDeveloperUA did you fix it?? Can u please attach screenshot of your code

gqmv commented 1 year ago

I've fixed it in a kinda dodgy way. It works as expected when the creator Center beta is active, but takes 60 extra seconds on the navigate to upload page function when otherwise. I have a pr opened for it. Not sure if it should be merged tho, cus that's a pretty big side effect.

JuniorDeveloperUA commented 1 year ago

@diegotrasobares https://pastebin.com/gudA1KUd password: 24470vQMpS upload.py file and you need to add some lines to config.toml near old "iframe" in [selectors.upload]: iframe_creator = "//[@id='root']/div[2]/div[2]/div/div/iframe" upload_video_creator = "//[@id='root']/div/div/div/div/div/div/div/input"

for me when i start main.py first time it can be error, but next try its ok :D i can't image how its works but if it works i dont care)))

diegotrasobares commented 1 year ago

@JuniorDeveloperUA Thanks buddy!! Im going to try it now, hope it get fix soon...

wkaisertexas commented 1 year ago

Using "//[@id='root']/div/div/div/div/div/div/div/input" as a file selector (though it is what the Chrome devtools gives you) is inherently more fragile to UI changes. Accessing properties of elements such as an input which has a file as input is typically more durable.