546200350 / TikTokUploder

Upload video to Tik Tok by sessionId
MIT License
163 stars 27 forks source link

Proposed: A fix for a bug in uploader.py for scheduler #81

Open JurijsNazarovs opened 1 year ago

JurijsNazarovs commented 1 year ago

There is a bug in uploader.py when checking boundaries for scheduling time. Instead of

 min_schedule_time = datetime.datetime.utcnow() +

should use

import pytz
 min_schedule_time = datetime.datetime.now().astimezone(pytz.UTC).timestamp() +

The reason is because datetime.datetime.utcnow() will take current time and transfer to etc zone. E.g., if you live in zone -7 and it is 5am, it will make a min_schedule_time to be 12pm of UTC. Which will show an error "cannot schedule in 20 minutes", until you schedule something in advance for 7 hours 20 minutes.