Fucking leap years2

main
Terence Eden 2024-02-29 09:17:00 +00:00
rodzic 2fd688da74
commit fd0c309f7f
1 zmienionych plików z 16 dodań i 12 usunięć

Wyświetl plik

@ -27,15 +27,19 @@ while (year_counter >= year_joined ) :
year_counter -= 1 year_counter -= 1
# The end of today is the start of tomorrow # The end of today is the start of tomorrow
# This means yesterday can take into account leap-years # This means yesterday can take into account leap-years
today_end = datetime(year_counter, month_now, day_now, 00, 00) + timedelta(days=1) try:
yesterday_end = today_end - timedelta(days=1) today_end = datetime(year_counter, month_now, day_now, 00, 00) + timedelta(days=1)
# Bitwise shift the integer representation and convert to milliseconds yesterday_end = today_end - timedelta(days=1)
max_id = ( int( today_end.timestamp() ) << 16 ) * 1000 # Bitwise shift the integer representation and convert to milliseconds
min_id = ( int( yesterday_end.timestamp() ) << 16 ) * 1000 max_id = ( int( today_end.timestamp() ) << 16 ) * 1000
# Call the API min_id = ( int( yesterday_end.timestamp() ) << 16 ) * 1000
statuses = mastodon.account_statuses(id = my_id, max_id=max_id, min_id=min_id, limit="40", exclude_reblogs=True) # Call the API
# Fetch further statuses if there are any statuses = mastodon.account_statuses(id = my_id, max_id=max_id, min_id=min_id, limit="40", exclude_reblogs=True)
all_statuses = statuses #mastodon.fetch_remaining(statuses) # Fetch further statuses if there are any
# Print the date and URl all_statuses = statuses #mastodon.fetch_remaining(statuses)
for status in all_statuses : # Print the date and URl
print( str(status["created_at"])[:16] + " " + BeautifulSoup(status["content"], features="html.parser").get_text() + " - " + status["uri"] + "\n") for status in all_statuses :
print( str(status["created_at"])[:16] + " " + BeautifulSoup(status["content"], features="html.parser").get_text() + " - " + status["uri"] + "\n")
except:
print( str(year_counter) + " is not a leap year.")