wkaisertexas / tiktok-uploader

Automatically ⬆️ upload TikTok videos
https://pypi.org/project/tiktok-uploader/
MIT License
390 stars 91 forks source link

Simplifies the _set_description function fixing hashtags and mentions #128

Closed callumjamesfortune closed 6 months ago

callumjamesfortune commented 7 months ago

This PR solves a problem that has been mentioned in a couple of issues where the hashtags and mentions are not being added correctly. The most likely reason for this is simply changes to the TikTok UI however they have made the hashtag and mention selection stage much more difficult to execute because there are no good elements to anchor to.

One effect that I noticed whilst testing the code is that if a space is typed after a hashtag and then backspaced, the first hashtag suggestion will be an exact match of the hashtag you are trying to add, meaning we do not have to anchor to an element and click it, we can simply send an ENTER key. The same applies to the mention functionality. This meant that the size of the _set_description function can be greatly reduced. I also fine-tuned the timing between actions to make sure that the correct values will be inserted into the description, for this I used the implicit wait value that exists in the config.

Because we no longer have to select the dropdown elements, I have removed these selectors from the config file.

In order to show the functionality working again, I have added a hashtag and mention into the description string in the basic_upload.py file.

Hopefully this will close one or two issues on this project.

Below is a screenshot of the updated script in action, correctly adding hashtags and mentions:

image

Co-authored-by: Callum Fortune callumfortune03@outlook.com Co-authored-by: Jamadoo

TediSina commented 6 months ago

The hashtags and mentions work great, but for some reason for me it doesn't clear the entire description at the beginning of the function, causing me to clear it manually so that the program can go on to do its thing.

TediSina commented 6 months ago

Somebody already created an issue about this #131

The hashtags and mentions work great, but for some reason for me it doesn't clear the entire description at the beginning of the function, causing me to clear it manually so that the program can go on to do its thing.

callumjamesfortune commented 6 months ago

@MatetePlays Yeh I looked into this and a change was suggested which I have pushed to this PR, the commit is (https://github.com/wkaisertexas/tiktok-uploader/pull/128/commits/4bf8836589844d60e09ddf2e3fe4b446454c1011). Hopefully that sorts it out, there are a few changes on that commit that aren't relevant to your issue though.

TediSina commented 6 months ago

@MatetePlays Yeh I looked into this and a change was suggested which I have pushed to this PR, the commit is (4bf8836). Hopefully that sorts it out, there are a few changes on that commit that aren't relevant to your issue though.

It works great now, thanks!

wkaisertexas commented 6 months ago

Thanks @callum-fortune and @MatetePlays

I have published a new version of the project on PyPI