Instead of trying to find the creation date of the thread, new threads are considered so if they aren't present in the databases. When they are not, they are added to the databases and to the corresponding text files.
For now, you need to manually create the "month.txt" and "month_tokens.txt" files. You create them for the current month, then launch the script. The current flaw is that if the databases aren't up-to-date, threads from previous months will be added to the .txt files.