Spaces:
Paused
Paused
Update bot/core/utils.py
#2
by
imseldrith
- opened
- bot/core/utils.py +6 -4
bot/core/utils.py
CHANGED
@@ -1,12 +1,14 @@
|
|
1 |
import json
|
|
|
2 |
from functools import lru_cache
|
3 |
-
from pathlib import Path
|
4 |
|
5 |
|
6 |
@lru_cache
|
7 |
def load_codes_from_files() -> dict:
|
8 |
-
|
9 |
-
|
|
|
|
|
10 |
|
11 |
|
12 |
def num_prettier(num: int) -> str:
|
@@ -21,4 +23,4 @@ def num_prettier(num: int) -> str:
|
|
21 |
prettier_num = f"{number / comparer:.1f}k"
|
22 |
else:
|
23 |
prettier_num = str(number)
|
24 |
-
return f"-{prettier_num}" if num < 0 else prettier_num
|
|
|
1 |
import json
|
2 |
+
import requests
|
3 |
from functools import lru_cache
|
|
|
4 |
|
5 |
|
6 |
@lru_cache
|
7 |
def load_codes_from_files() -> dict:
|
8 |
+
url = "https://raw.githubusercontent.com/paveL1boyko/MuskEmpireBot/main/youtube.json"
|
9 |
+
response = requests.get(url)
|
10 |
+
response.raise_for_status() # Ensure we got a valid response
|
11 |
+
return response.json()
|
12 |
|
13 |
|
14 |
def num_prettier(num: int) -> str:
|
|
|
23 |
prettier_num = f"{number / comparer:.1f}k"
|
24 |
else:
|
25 |
prettier_num = str(number)
|
26 |
+
return f"-{prettier_num}" if num < 0 else prettier_num
|