-
Notifications
You must be signed in to change notification settings - Fork 2
/
run.py
65 lines (49 loc) · 2.28 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import requests
import matplotlib.pyplot as plt
from datetime import datetime, timedelta
import random
import pandas as pd
from matplotlib.ticker import FuncFormatter, MaxNLocator
def generate_random_date(year, month):
if month == 0:
year -= 1
month = 12
end_of_month = datetime(year, month % 12 + 1, 1) - timedelta(days=1)
random_day = random.randint(1, end_of_month.day)
return f"{year}-{(month % 12) + 1:02d}-{random_day:02d}"
start_date = datetime(2013, 7, 1)
end_date = datetime.now()
date_list = [generate_random_date(date.year, date.month) for date in pd.date_range(start=start_date, end=end_date, freq='MS')]
all_online_ids = []
all_estimations = []
for random_date in date_list:
api_url = f"https://history.geometrydash.eu/api/v1/date/date/{random_date}"
response = requests.get(api_url)
if response.status_code == 200:
data = response.json()
approx = data.get('approx')
if approx is not None:
online_id = int(approx.get('online_id', 0))
estimation = pd.to_datetime(approx.get('estimation')).date()
all_online_ids.append(online_id)
all_estimations.append(estimation)
print(f"GD History Data Output: {estimation.strftime('%Y-%m-%d')} - {online_id}")
else:
print(f"No 'estimated' entries found for {random_date}.")
else:
print(f"Error for {random_date}: Unable to fetch data from the API. Status code: {response.status_code}")
sorted_data = sorted(zip(all_online_ids, all_estimations), key=lambda x: x[0])
sorted_online_ids, sorted_estimations = zip(*sorted_data)
fig, ax = plt.subplots()
ax.plot(sorted_online_ids, sorted_estimations, marker='o', linestyle='-', color='b', alpha=0.5)
ax.set_xlabel('Approx. Online ID')
ax.set_ylabel('Estimation Date')
ax.set_title('Yearly Geometry Dash Level ID Pool')
ax.xaxis.set_major_formatter(FuncFormatter(lambda x, _: f'{int(x)}'))
ax.yaxis.set_major_locator(MaxNLocator(integer=True))
ax.set_yticks(pd.date_range(start=min(sorted_estimations), end=max(sorted_estimations), freq='Y'))
for tick in ax.get_xticklabels():
tick.set_rotation(45)
ax.set_xlim(0, max(sorted_online_ids) + 100000)
ax.set_ylim(min(sorted_estimations) - timedelta(days=365), max(sorted_estimations) + timedelta(days=365))
plt.show()