Spaces:
Running
Running
Upload main.py
Browse files
main.py
CHANGED
@@ -74,11 +74,11 @@ logging.basicConfig(level=logging.ERROR)
|
|
74 |
|
75 |
# I DON'T KNOW LIKE THIS HACKER
|
76 |
load_dotenv()
|
|
|
|
|
77 |
MONGO_URL = os.environ["MONGO_URL"]
|
78 |
-
|
79 |
-
|
80 |
-
ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
|
81 |
-
HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
|
82 |
SOURCE_UNSPLASH_URL = os.environ["SOURCE_UNSPLASH_URL"]
|
83 |
SOURCE_OCR_URL = os.environ["SOURCE_OCR_URL"]
|
84 |
SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
|
@@ -88,8 +88,16 @@ SOURCE_TIKTOK_TECH_URL = os.environ["SOURCE_TIKTOK_TECH_URL"]
|
|
88 |
SOURCE_CALLI_GRAPHY_URL = os.environ["SOURCE_CALLI_GRAPHY_URL"]
|
89 |
SOURCE_WHAT_GAY_URL = os.environ["SOURCE_WHAT_GAY_URL"]
|
90 |
SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
|
92 |
COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
|
|
|
93 |
|
94 |
client_mongo = MongoClient(MONGO_URL)
|
95 |
db = client_mongo["tiktokbot"]
|
@@ -601,6 +609,79 @@ def v1beta2_google_ai(
|
|
601 |
except:
|
602 |
return {"status": "false", "message": "Error response."}
|
603 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
604 |
async def get_data(username):
|
605 |
base_msg = ""
|
606 |
async with AsyncClient() as gpx:
|
|
|
74 |
|
75 |
# I DON'T KNOW LIKE THIS HACKER
|
76 |
load_dotenv()
|
77 |
+
|
78 |
+
# Database url
|
79 |
MONGO_URL = os.environ["MONGO_URL"]
|
80 |
+
|
81 |
+
# source url
|
|
|
|
|
82 |
SOURCE_UNSPLASH_URL = os.environ["SOURCE_UNSPLASH_URL"]
|
83 |
SOURCE_OCR_URL = os.environ["SOURCE_OCR_URL"]
|
84 |
SOURCE_ALPHA_URL = os.environ["SOURCE_ALPHA_URL"]
|
|
|
88 |
SOURCE_CALLI_GRAPHY_URL = os.environ["SOURCE_CALLI_GRAPHY_URL"]
|
89 |
SOURCE_WHAT_GAY_URL = os.environ["SOURCE_WHAT_GAY_URL"]
|
90 |
SOURCE_ASSISTANT_GOOGLE_AI = os.environ["SOURCE_ASSISTANT_GOOGLE_AI"]
|
91 |
+
SOURCE_MONITOR_URL = os.environ["SOURCE_MONITOR_URL"]
|
92 |
+
|
93 |
+
# api keys
|
94 |
+
REVERSE_IMAGE_API = os.environ["REVERSE_IMAGE_API"]
|
95 |
+
OCR_API_KEY = os.environ["OCR_API_KEY"]
|
96 |
+
ONLY_DEVELOPER_API_KEYS = os.environ["ONLY_DEVELOPER_API_KEYS"]
|
97 |
+
HUGGING_TOKEN = os.environ["HUGGING_TOKEN"]
|
98 |
ASSISTANT_GOOGLE_API_KEYS = os.environ["ASSISTANT_GOOGLE_API_KEYS"]
|
99 |
COOKIE_BARD_TOKEN = os.environ["COOKIE_BARD_TOKEN"]
|
100 |
+
MONITOR_API_KEYS = os.environ["MONITOR_API_KEYS"]
|
101 |
|
102 |
client_mongo = MongoClient(MONGO_URL)
|
103 |
db = client_mongo["tiktokbot"]
|
|
|
609 |
except:
|
610 |
return {"status": "false", "message": "Error response."}
|
611 |
|
612 |
+
@app.post("/ryuzaki/new-monitor")
|
613 |
+
def new_monitor(
|
614 |
+
url: str,
|
615 |
+
type: int=1,
|
616 |
+
friendly_name: str,
|
617 |
+
api_key: None = Depends(validate_api_key)
|
618 |
+
):
|
619 |
+
url = SOURCE_MONITOR_URL
|
620 |
+
token = MONITOR_API_KEYS
|
621 |
+
api_url = f"{url}/newMonitor"
|
622 |
+
try:
|
623 |
+
headers = {
|
624 |
+
"content-type": "application/x-www-form-urlencoded",
|
625 |
+
"cache-control": "no-cache"
|
626 |
+
}
|
627 |
+
payload = {
|
628 |
+
"api_key": token,
|
629 |
+
"format": "json",
|
630 |
+
"type": type,
|
631 |
+
"url": url,
|
632 |
+
"friendly_name": friendly_name
|
633 |
+
}
|
634 |
+
response = requests.post(api_url, data=payload, headers=headers)
|
635 |
+
response_str = response.json()
|
636 |
+
status_ok = response_str["stat"]
|
637 |
+
monitor_id = response_str["monitor"].get("id")
|
638 |
+
monitor_status = response_str["monitor"].get("status")
|
639 |
+
return {
|
640 |
+
"status": "true",
|
641 |
+
"randydev":{
|
642 |
+
"status_ok": status_ok,
|
643 |
+
"monitor_id": monitor_id,
|
644 |
+
"monitor_status": monitor_status
|
645 |
+
}
|
646 |
+
}
|
647 |
+
except:
|
648 |
+
return {"status": "false", "message": "Error response."}
|
649 |
+
|
650 |
+
@app.post("/ryuzaki/get-monitors")
|
651 |
+
def getMonitors(
|
652 |
+
logs: int=1,
|
653 |
+
api_key: None = Depends(validate_api_key)
|
654 |
+
):
|
655 |
+
url = SOURCE_MONITOR_URL
|
656 |
+
token = MONITOR_API_KEYS
|
657 |
+
api_url = f"{url}/getMonitors"
|
658 |
+
try:
|
659 |
+
headers = {
|
660 |
+
"content-type": "application/x-www-form-urlencoded",
|
661 |
+
"cache-control": "no-cache"
|
662 |
+
}
|
663 |
+
payload = {
|
664 |
+
"api_key": token,
|
665 |
+
"format": "json",
|
666 |
+
"logs": logs
|
667 |
+
}
|
668 |
+
response = requests.post(api_url, data=payload, headers=headers)
|
669 |
+
response_str = response.json()
|
670 |
+
data = response_str["monitors"]
|
671 |
+
url_list = []
|
672 |
+
for x in data:
|
673 |
+
url = x.get("url")
|
674 |
+
if url:
|
675 |
+
url_list.append(url)
|
676 |
+
return {
|
677 |
+
"status": "true",
|
678 |
+
"randydev":{
|
679 |
+
"url": url_list,
|
680 |
+
}
|
681 |
+
}
|
682 |
+
except:
|
683 |
+
return {"status": "false", "message": "Error response."}
|
684 |
+
|
685 |
async def get_data(username):
|
686 |
base_msg = ""
|
687 |
async with AsyncClient() as gpx:
|