diff --git a/pymstdncollect/src/db.py b/pymstdncollect/src/db.py index 5d1c250..3a17b39 100644 --- a/pymstdncollect/src/db.py +++ b/pymstdncollect/src/db.py @@ -243,7 +243,7 @@ def execute_update_context_sql(dbconnection, table, headtoot, repliestoot, auth_ monthyear = pd.Timestamp(np.datetime64(parenttoot["created_at"])).tz_localize("CET").astimezone(pytz.utc) except: monthyear = pd.Timestamp(np.datetime64(parenttoot["created_at"])).tz_localize("Europe/Paris").astimezone(pytz.utc) - if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')): + if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d').tz_localize("Europe/Paris").astimezone(pytz.utc)): # do not collect it, in_reply_to_id field of reply remains unchanged continue parentglobalID = parenttoot["globalID"] diff --git a/pymstdncollect/src/toots.py b/pymstdncollect/src/toots.py index a16af3e..cdb8f66 100644 --- a/pymstdncollect/src/toots.py +++ b/pymstdncollect/src/toots.py @@ -198,7 +198,7 @@ def collect_user_postingactivity_apidirect(useracct, instance_name, savedir="/tm print(monthyear) - if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')): + if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')).tz_localize("Europe/Paris").astimezone(pytz.utc): # do not collect it continue i["instance_name"] = tootinstance @@ -499,7 +499,7 @@ def contains_kw(x): return x.lower() in toottext monthyear = pd.Timestamp(np.datetime64(parenttoot["created_at"])).tz_localize("CET").astimezone(pytz.utc) except: monthyear = pd.Timestamp(np.datetime64(parenttoot["created_at"])).tz_localize("Europe/Paris").astimezone(pytz.utc) - if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')): + if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')).tz_localize("Europe/Paris").astimezone(pytz.utc): # do not collect it raise AttributeError parenttoot["account"] = add_unique_account_id(parenttoot["account"], i["instance_name"]) diff --git a/pymstdncollect/user_scripts/hashtags_contexts_collection.py b/pymstdncollect/user_scripts/hashtags_contexts_collection.py index 4704b21..0e5b06a 100644 --- a/pymstdncollect/user_scripts/hashtags_contexts_collection.py +++ b/pymstdncollect/user_scripts/hashtags_contexts_collection.py @@ -142,7 +142,7 @@ def collect_timeline_hashtag_apidirect(hashtag=None, url=None, local=False, remo monthyear = pd.Timestamp(np.datetime64(idesc["created_at"])).tz_localize("CET").astimezone(pytz.utc) except: monthyear = pd.Timestamp(np.datetime64(idesc["created_at"])).tz_localize("Europe/Paris").astimezone(pytz.utc) - if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')): + if monthyear < pd.Timestamp(cutoff_date).tz_localize("Europe/Paris").astimezone(pytz.utc) or monthyear > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')).tz_localize("Europe/Paris").astimezone(pytz.utc): # do not collect it continue diff --git a/pymstdncollect/user_scripts/weekly_postcollection.py b/pymstdncollect/user_scripts/weekly_postcollection.py index fe91898..2e36241 100644 --- a/pymstdncollect/user_scripts/weekly_postcollection.py +++ b/pymstdncollect/user_scripts/weekly_postcollection.py @@ -77,7 +77,7 @@ def weekly_users_postcollection(sourcedir, mindate, maxdate, dbconn=None, outdir tootdate = pd.Timestamp(np.datetime64(usertoot["created_at"])).tz_localize("CET").astimezone(pytz.utc) except: tootdate = pd.Timestamp(np.datetime64(usertoot["created_at"])).tz_localize("Europe/Paris").astimezone(pytz.utc) - if tootdate < mindate or tootdate > maxdate or tootdate > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')): + if tootdate < mindate or tootdate > maxdate or tootdate > pd.Timestamp(datetime.today().strftime('%Y-%m-%d')).tz_localize("Europe/Paris").astimezone(pytz.utc): continue # get boosts for user statuses of current week reblogs = get_boosts(usertoot, row["instance_name"], auth_dict=auth_dict)